All Projects → amcquade → fresh_script

amcquade / fresh_script

Licence: MIT license
Find Spotify tracks posted to the HipHopHeads subreddit and add them to a Spotify playlist.

Programming Languages

python
139335 projects - #7 most used programming language
HTML
75241 projects
CSS
56736 projects

Projects that are alternatives of or similar to fresh script

Ripme
Downloads albums in bulk
Stars: ✭ 2,748 (+3882.61%)
Mutual labels:  reddit, help-wanted, up-for-grabs, good-first-issue
Up For Grabs.net
This is a list of projects which have curated tasks specifically for new contributors. These issues are a great way to get started with a project, or to help share the load of working on open source projects. Jump in!
Stars: ✭ 2,427 (+3417.39%)
Mutual labels:  help-wanted, up-for-grabs, good-first-issue
Web-Development
Created this new Repository for Open Source Contribution for Beginners
Stars: ✭ 25 (-63.77%)
Mutual labels:  help-wanted, up-for-grabs, good-first-issue
loseyourself
Lose yourself, programmer edition. Based on a tweet by @kvlly!
Stars: ✭ 34 (-50.72%)
Mutual labels:  reddit, hiphop
Partify
This is a free open source Spotify-powered app that lets users host parties and have guests connect using their smartphones to submit and vote on songs. The app will only play the highest voted song and can connect to personal playlists.
Stars: ✭ 37 (-46.38%)
Mutual labels:  playlist, spotify
paystack-music-api
The bot and API that powers Paystack Music.
Stars: ✭ 70 (+1.45%)
Mutual labels:  playlist, spotify
yaclt
Yet Another Change Log Tool
Stars: ✭ 24 (-65.22%)
Mutual labels:  help-wanted, good-first-issue
SpotifyWebApi
A .net core wrapper for the Spotify Web API
Stars: ✭ 19 (-72.46%)
Mutual labels:  playlist, spotify
hacktoberfest
Contribute to this repo for your T-shirt, must be relevant that can add some value to this repo.
Stars: ✭ 33 (-52.17%)
Mutual labels:  up-for-grabs, good-first-issue
spotipy2
The next generation Spotify Web API wrapper for Python 3.7+
Stars: ✭ 25 (-63.77%)
Mutual labels:  spotify, spotipy
spotify-vibe-check
Spotify Vibe Checker Web App to vibe check your Spotify Playlists! (currently broken due to CORS)
Stars: ✭ 24 (-65.22%)
Mutual labels:  playlist, spotify
styles
A collection of cool effects in html, css and javascript.
Stars: ✭ 35 (-49.28%)
Mutual labels:  beginner, good-first-issue
corejam
A scaffolding for building progressive GraphQL powered jamstack applications.
Stars: ✭ 24 (-65.22%)
Mutual labels:  help-wanted, up-for-grabs
MusicPlayer
A Telegram Music Bot written in Python using Pyrogram and Py-Tgcalls. This is Also The Source Code of The UserBot Which is Playing Music in @S1-BOTS Support Group ❤️
Stars: ✭ 218 (+215.94%)
Mutual labels:  playlist, spotify
ideas-for-projects-people-would-use
Every time I have an idea, I write it down. These are a collection of my top software ideas -- problems I think enough people have that don't have solutions. I expect you can reach a decent userbase if marketed correctly, as I am surely not the only one with these problems.
Stars: ✭ 646 (+836.23%)
Mutual labels:  playlist, spotify
DownloadRedditImages
Easily download all the images from any subreddit (also select sort_type if you want hot/top/new/controversial, and also sort_time day/week/month/year/all). Randomly select downloaded images and set as wallpaper, updating every 30 mins (or whenever you want duh)!
Stars: ✭ 66 (-4.35%)
Mutual labels:  reddit, reddit-crawler
stirfry
StirFry is a self contained and lightweight web framework for nodejs
Stars: ✭ 24 (-65.22%)
Mutual labels:  help-wanted, up-for-grabs
FavouriteAnime-Hacktoberfest
Add your favorite Anime with your name
Stars: ✭ 20 (-71.01%)
Mutual labels:  up-for-grabs, good-first-issue
Spotlistr
🎧 Convert Anything to a Spotify Playlist!
Stars: ✭ 226 (+227.54%)
Mutual labels:  playlist, spotify
Singlespotify
🎵 Create Spotify playlists based on one artist through the command line
Stars: ✭ 254 (+268.12%)
Mutual labels:  playlist, spotify

fresh_script

This program will search for spotify tracks posted in the HipHopHeads subreddit and add them to a playlist of your choice. HipHopHeads is a subreddit dedicated to everything hiphop, including the latest mixtapes, videos, news, and anything else hip hop related from your favorite artists.

New Features!

Flask has recently been added to the project. You can read up on how to get it setup here.

Getting Started

Prerequisites

This project uses Python3.

You will need to setup a Spotify developer account and register your app and obtain the following information:

  • client id
  • client secret
  • your spotify username
  • playlist id of the playlist you want to add the tracks to
  • the url you want to redirect to for authentication, i.e. http://google.com/
    • this must be added under your app settings > Redirect URIs

You will also need to setup a reddit instance with praw. Here's a useful guide I used to do this.

Setup your Credentials

To set up your credentials, create a new file called credentials.json in the root of the project with the following contents:

{
    "spotify": {
        "username": "[Spotify username]",
        "client_id": "[Spotify client id]",
        "client_secret": "[Spotify client secret]",
        "redirect": "[redirect uri]"
    },
    "reddit": {
        "username": "[reddit username]",
        "client_id": "[praw client id]",
        "client_secret": "[praw client secret]"
    }
}

Installing dependencies

This project uses a dependency manager called pipenv. Follow the instructions to install it here.

The project dependencies are listed in a Pipfile. Using pipenv, you can install all the dependencies with the following commands:

cd fresh_script
pipenv install

Pipenv uses virtualenv to create a python environment with all the dependencies listed in the Pipfile. Before running the fresh.py script, you must first activate the environment:

pipenv shell

If you wish to deactivate the environment use the command

exit

Running the script

Running the program is simple. The first time you run it, you will be asked for your Spotify credientials which will be saved to a config file for ease of use in the future. Choose to sort results by hot or new, enter a post limit, and then enjoy.

python3 fresh.py

Script arguments

The following arguments can be passed to the script

Short Long Type Description
-s --sort string Sort by hot, new, rising, random_rising, controversion or top
-l --limit int How many posts to grab
-t --threshold int Only posts with score above threshold
-f --fresh bool Only add tracks with the [FRESH] tag
-ia --include-albums bool Include tracks from albums
-v --verbose bool Output songs being added and other info
-p --playlists bool List, add, or remove playlists to add songs to

Running the script using cron

We can use cron to automatically run the script periodically in order to keep it up-to-date. You will need either a macOS computer or Linux server to use cron.

  1. Follow the running the script instructions to make sure your .config.ini file is generated with the required parameters
  2. Run crontab -e to open the cron editor, which is similar to vim
  3. Use the following format to create a line for your cron
    * * * * * command to be executed
    - - - - -
    | | | | |
    | | | | ----- Day of week (0 - 7) (Sunday=0 or 7)
    | | | ------- Month (1 - 12)
    | | --------- Day of month (1 - 31)
    | ----------- Hour (0 - 23)
    ------------- Minute (0 - 59)
    
    For example, you would do the following to run this everyday at 9AM
    0 9 * * * python /home/jsmith/fresh.py
    

Contributing

I appreciate any help and support. Feel free to fork and create a pull request

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].