Code Monkey home page Code Monkey logo

spotify-wordcloud's Introduction

Spotify WordCloud

Codacy Badge Lint + Format + Test Code style: black

English · 日本語




Spotify WordCloud is an app that lets you create a word cloud from the names of your favorite artists.
You can tweet the word cloud on the spot. You can also save the word cloud and look back at it later.

👉 spotify-word.cloud
(currently only available in Japanese)



Local development

Requirements

  • Docker
  • Python 3.8
  • Spotify Account
  • GCP Account (to save images in Google Cloud Storage)

Installation

$ git clone https://github.com/HelloRusk/spotify-wordcloud
$ cd spotify-wordcloud
$ poetry install
$ poetry shell

Configuration

Set local environment variables in .env.
You can refer to .env.example.

Initialize DB

$ docker-compose up -d
$ FLASK_DEBUG=True FLASK_APP=run.py flask shell
>>> from spotify_wordcloud.app import db
>>> db.create_all()

Run server

$ FLASK_DEBUG=True OAUTHLIB_INSECURE_TRANSPORT=1 python run.py

and open http://localhost:5000/.

Test

$ TESTING=True python -m pytest

URL

Path Method Description
/ GET Display the top screen
/login GET Log in to Spotify
/login/spotify/authorized GET Callback for Spotify OAuth authentication
/logout GET Log out
/generate GET Create a word cloud image and return its binary
/regenerate GET Create a word cloud image and return its binary
(Unlike /generate method, it forces re-creation even if there is a cache)
/save POST Create a word cloud image, upload the image to GCS, and save it in the DB with user ID and creation date
/shareLink GET Create a word cloud image and obatin the link
/shareTwitter POST Create a word cloud image and open the tweet screen
/share/:file_hash GET Entry for Open Graph Protocol
/history GET Display the list of images created in the past
/history/:file_hash DELETE Delete the specified image

Learn more about creating word cloud images

This app retrieves the list of top artists from Spotify's "Get a User's Top Artists" API, combines them into a single string, and creates a word cloud based on it.
The combined string is kept in the session. The image is placed in the /tmp folder with the hash of the string as the file name.
URLs related to image creation will always try to refer to these cached information first. However, /regenerate does not refer to the /tmp folder, and creates the image again.

spotify-wordcloud's People

Contributors

codacy-badger avatar dependabot[bot] avatar kaisugi avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar

spotify-wordcloud's Issues

フロントをSPAにしたい

合わせて、ナイトモード対応とか
合わせて、開発環境のDocker化とか
デザインに neumorphism.io を取り入れてみたい

画像のアーティスト名のロジックの変更

Run Girls, Run! のような1アーティスト名に Run が2つも含まれているようなものが過剰に多くカウントされているような疑いがある

空白区切りして、重複を削除した方がいいかもしれない

フォームを用意する

バグ報告の誘導は Google Form に
「このサイトのソースコード」でこちらに導線をはる

GET /history で psycopg2 のエラー

たまにDBへの接続がバグる

May 30 17:50:33 ip-172-31-47-129 web: psycopg2.OperationalError: SSL connection has been closed unexpectedly
May 30 17:50:33 ip-172-31-47-129 web: The above exception was the direct cause of the following exception:
May 30 17:50:33 ip-172-31-47-129 web: Traceback (most recent call last):
May 30 17:50:33 ip-172-31-47-129 web: File "/var/app/venv/staging-LQM1lest/lib/python3.7/site-packages/gunicorn/workers/sync.py", line 134, in handle
May 30 17:50:33 ip-172-31-47-129 web: self.handle_request(listener, req, client, addr)

DB接続まわりの処理でエラーハンドリングをしっかりさせたい

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.