Coder Social home page Coder Social logo

spotify_playlist_generator's Introduction

                  _   _  __       
  ___ _ __   ___ | |_(_)/ _|_   _ 
 / __| '_ \ / _ \| __| | |_| | | |
 \__ \ |_) | (_) | |_| |  _| |_| |
 |___/ .__/ \___/ \__|_|_|  \__, |
     |_|                    |___/ 

        _             _ _     _   
  _ __ | | __ _ _   _| (_)___| |_ 
 | '_ \| |/ _` | | | | | / __| __|
 | |_) | | (_| | |_| | | \__ \ |_ 
 | .__/|_|\__,_|\__, |_|_|___/\__|
 |_|            |___/             

                                  _             
   __ _  ___ _ __   ___ _ __ __ _| |_ ___  _ __ 
  / _` |/ _ \ '_ \ / _ \ '__/ _` | __/ _ \| '__|
 | (_| |  __/ | | |  __/ | | (_| | || (_) | |   
  \__, |\___|_| |_|\___|_|  \__,_|\__\___/|_|   
  |___/                                         

=========

When I finally caved and switched from iTunes to Spotify there was a smart playlist shaped hole in my heart. And thus spotify playlist generator was born.

Maybe you don't have a box to schedule it on. Maybe you don't want to get Spotify API keys. Maybe you have a nerdy friend who could schedule it for you and share a Dropbox folder for your playlist specs. iykyk

This is a personal project and corners have been cut strategically in order to keep things moving within my time constraints. Git commits are less than atomic, file structure isn't the best, unit tests are AWOL, documentation is completely absent, the rubber duck is an unpaid intern, etc etc. However, it's been the Alfred of my playlists for a few years now and it isn't likely to retire to a European cafe anytime soon.

This documentation is a work in progress. ymmv

Contents

Installation

Option 1 - make like Dolly

  1. install dotnet

  2. get your Spotify API keys

  3. git clone

     git clone https://github.com/buckmanc/spotify_playlist_generator.git
    
  4. add your API keys to the config file

  5. run once and do the login process

     dotnet run
    
  6. move the playlist folder or keep the default (put it in your Dropbox and edit wherever)

  7. make some playlists!

  8. schedule it to run nightly, weekly, once every full moon, etc.

Option 2 - get a friend to run it for you

  1. message your resident nerd
  2. share a Dropbox folder with them
  3. do some login stuff
  4. profit

Option 3

  1. buy it
  2. store it

Options

Playlist Parameters:

Playlist parameters tell the app what songs to add to the playlist. The core use of the app is right here.

All of these can accept the name of the artist/album/playlist or the Spotify ID. (You can pull the IDs from the share URL.) Most of these accept wildcards. (All except AllByArtist and TopByArtist... but those might work anyway.) Playlist names only work for playlists you follow or own, otherwise the ID is required.

LikesByGenre is the most broadly useful playlist parameter.

Album                      All tracks on this album. Accepts album ID or names in the form "Artist Name - Album Name". Album ID performs significantly faster.
AlbumsFromPlaylist         All tracks from all albums with any song in this playlist
AllByArtist                All tracks by this artist. Can be intensive. Specifying artist ID instead of artist name can reduce the load somewhat. Using an artist name is very likely to include duplicate artists with the same name.
AllByArtistFromPlaylist    All tracks by all artists in this playlist
LikesByArtist              Liked tracks by this artist.
LikesByArtistFromPlaylist  Liked tracks by all artists in this playlist.
LikesByGenre               All liked tracks with the specified genre. Wildcards are very useful here.
LikesFromPlaylist          All liked tracks in this playlist.
PlaylistTracks             Tracks in this playlist.
TopByArtist                The top five tracks on Spotify by this artist. Has the same performance issues as AllByArtist.
TopByArtistFromPlaylist    The top five tracks on Spotify by every artist in this playlist.
Track                      Single track by ID.
-Album                     Exclude all tracks matching this album.
-Artist                    Exclude all tracks matching this artist.
-From                      Exclude all tracks with a matching "from" clause in the track name. This is primarily useful for soundtrack and video game covers.
-Genre                     Exclude all tracks matching this genre.
-PlaylistAlbums            Exclude all albums in this playlist.
-PlaylistArtists           Exclude all artists in this playlist.
-PlaylistTracks            Exclude all tracks in this playlist.
-Track                     Exclude all tracks with a matching name or ID.

Playlist Options:

Playlist options are preceded by "@" and affect the playlist as a whole.

AddParameterIDs           Exchange artist names for artist IDs. Saves time when running but looks worse. Same behaviour as --modify-playlist-file
Default                   Assume any lines with no parameter are this parameter. Great for pasting lists of artists.
DeleteIfEmpty             If the playlist has no tracks, delete it.
DontModify                Don't modify the playlist spec file, even if told to.
DontRemoveTracks          If tracks no longer fall within the scope of the playlist leave them anyway.
ExceptArtistFromPlaylist  A comma delimited list of artists to not actively include when using one of the ArtistFromPlaylist parameters.
ID                        The Spotify ID of this playlist after creation. Generally an output.
LastRun                   The date of last run. Only updated when OnlyRunIfModified is set.
LastXDays                 Limit to tracks released in the last X days.
LeaveImageAlone           Don't touch the artwork, even if told to.
LikedAfter                Limit to tracks liked after this date/time.
LikedBefore               Limit to tracks liked before this date/time.
LimitPerAlbum             Limit the amount of tracks per album, prioritizing by popularity.
LimitPerArtist            Limit the amount of tracks per artist, prioritizing by popularity.
LongerThan                Limit to tracks shorter than X minutes.
NoExplicit                Exclude tracks marked explicit.
NoLikes                   Exclude liked songs from this playlist.
OnlyCreatePlaylist        Don't run again after the playlist has been created. This can be reset by removing the @ID from the file.
OnlyRunIfModified         Don't run again unless the file has been modified.
ReleasedAfter             Limit to tracks released after this date.
ReleasedBefore            Limit to tracks released before this date.
ShorterThan               Limit to tracks longer than X minutes.
Sort                      How to sort the playlist. If not supplied this is decided based on playlist parameters. Options are Don't, Liked, Release, Artist.
UpdateSort                Actively keep this playlist sorted. Can also be set globally in config.ini

Config File Settings:

Settings that apply globally to all playlists.

documentation pending

Application Arguments:

Arguments for the program itself. These are not the primary function of the app but provide some nifty functionality.

--playlist-folder-path <playlist-folder-path>                            An alternate path for the playlists folder path. Overrides the value found in paths.ini.
--list-playlists                                                         List existing playlists from the playlists folder.
--playlist-name <playlist-name>                                          The name of the playlist to run alone, unless combined with --playlist-specs. Supports wildcards.
--playlist-spec <playlist-spec>                                          A playlist specification string for use when creating a new playlist from the command line.
--modify-playlist-file                                                   Exchange artist names for artist IDs. Saves time when running but looks worse.
--exclude-current-artist                                                 Adds an exclusion line for the currenly playing artist into the playlist. If no --playlist-name is specified the current playlist is used. Intended for refining playlists.
--exclude-current-album                                                  Adds an exclusion line for the currenly playing album into the playlist. If no --playlist-name is specified the current playlist is used. Intended for refining playlists.
--exclude-current-track                                                  Adds an exclusion line for the currenly playing track into the playlist. If no --playlist-name is specified the current playlist is used. Intended for refining playlists.
--add-current-artist                                                     Adds a line for the currenly playing artist into the playlist. If no --playlist-name is specified the current playlist is used. Intended for refining playlists.
--add-current-album                                                      Adds a line for the currenly playing album into the playlist. If no --playlist-name is specified the current playlist is used. Intended for refining playlists.
--add-current-track                                                      Adds a line for the currenly playing track into the playlist. If no --playlist-name is specified the current playlist is used. Intended for refining playlists.
--image-add-photo                                                        Assign a new image to the playlist.
--image-add-text                                                         Add text to the playlist image. The playlist name is used if no --image-text is provided.
--image-text <image-text>                                                Custom text to use for --image-add-text.
--image-font <image-font>                                                Font to use for --image-add-text. Can use wildcards.
--image-backup                                                           Happens automatically whenever modifying an image. Calling --image-backup directly overwrites previous backups.
--image-restore                                                          Restore a previously backed up image.
--image-text-alignment <BottomLeft|BottomRight|Center|TopLeft|TopRight>  Pick one of the corners or center. Defaults to bottom left.
--image-rotate-degrees <image-rotate-degrees>                            Rotate the image. You should really stick to 90 degree increments.
--image-clone <image-clone>                                              Clone the cover art from another of your playlists.
--image-nerd-font-glyph <image-nerd-font-glyph>                          Wildcard search for a Nerd Font glyph. Returns the symbol when used alone or used as the text with --image-add-text. You still have to specify an installed Nerd Font with --image-font.
--test-images <test-images>                                              Generate x test images instead of updating live playlists. Stored in the playlist folder.
--play                                                                   Play --playlist-name. If no playlist is provided, toggle playback. Can be used with --playlist-spec to build a new playlist and play it afterward.
--skip-next                                                              Skip forward.
--skip-previous                                                          Skip backward.
--like                                                                   Like the current track.
--unlike                                                                 Unlike the current track.
--what                                                                   Print details about the current track.
--what-else                                                              Print more details about the current track.
--reports                                                                Run only the reports.
--lyrics                                                                 Pass currently playing info to an external lyrics app specified in the config file.
--tab-completion-argument-names                                          A space delimited list of these arguments to pass to the bash "complete" function.
--update-readme                                                          Update readme.md. Only used in development.
--verbose                                                                Print more logging messages. Pretty messy. Overrides the settings file.
--version                                                                Show version information
-?, -h, --help                                                           Show help and usage information

Usage Examples

Neat Playlists

Want a playlist of all your symphonic metal likes? The playlist spec for that is one line:

LikesByGenre:symphonic metal

Or how about every liked song with "metal" in the genre? Also one line:

LikesByGenre:*metal*

Want all of a musician's side projects in one playlist? Slap the names in a playlist like this. (Note two ways of dealing with overlapping artist names.)

@default:AllByArtist
Crown of Asteria
Cave Mouth
Golden Light
Andvari
Enon Chapel
Great Cold Emptiness
6hXonF1DK45IuMCemMiyD2 # Heksebrann
Iarnvidjur
Tomblord
-Artist:5FKFbl2AqE6xL5bMEkXk4y # wrong cave mouth

Find an albums of the year list, but it's massive and you only want the most popular song from each album? Here you go:

@default:Album
@LimitPerAlbum:1
@Sort:Don't
@UpdateSort

Blind Guardian - The God Machine
Immolation - Acts of God
Negative Plane - The Pact....
Sumerlands - Dreamkiller
Voivod - Synchro Anarchy
White Ward - False Light
Sigh - Shiki
Blut Aus Nord - Disharmonium - Undreamable Abysses

Cool Command Line Tricks

Auto Completion With an Alias

TODO

Get and Translate Lyrics

TODO

spot --lyrics | trans -b | less

Trim Down a Playlist

TODO

spot --exclude-current-artist

Credits

spotify_playlist_generator's People

Contributors

buckmanc avatar

Watchers

 avatar  avatar

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.