Skip to content

darynwhite/lastfm-chart

Use this GitHub action with your project
Add this Action to an existing workflow or create a new one
View on Marketplace

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

209 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

last.fm weekly chart

banner

πŸ€– About this repo

This is a fork and rebuild of melipass/lastfm-to-markdown focused on refactoring the Python for readability and maintainability. Also adding new features with time so this can build any weekly/monthly/etc. report that the Last.FM API offers.

🎡 Example output, automatically updated every day

πŸ‘©πŸ½β€πŸ’» What you'll need

  • A README.md file.
  • Last.fm API key
    • Fill this form to instantly get one. Requires a last.fm account.
  • Set up a GitHub Secret called LASTFM_API_KEY with the value given by last.fm.
  • Also set up a LASTFM_USER GitHub Secret with the user you'll get the weekly charts for.
  • Add a <!-- lastfm --> tag in your README.md file, with two blank lines below it. The album covers will be placed here.

Instructions

To use this release, add a lastfm.yml workflow file to the .github/workflows folder in your repository with the following code:

name: lastfm-weekly-chart

on:
  schedule:
    - cron: '2 0 * * *'
  workflow_dispatch:

jobs:
  lastfm:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v2
      - name: lastfm to markdown
        uses: darynwhite/lastfm-weekly-chart@2.0
        with:
          LASTFM_API_KEY: ${{ secrets.LASTFM_API_KEY }}
          LASTFM_USER: ${{ secrets.LASTFM_USER }}
          # INCLUDE_LINK: true # Optional. Defaults is false. If you want to include the link to the album page, set this to true.
          # IMAGE_COUNT: 6 # Optional. Defaults to 10. Feel free to remove this line if you want. Last.fm API will produce up to 50 albums.
          # IMAGE_SIZE: 'medium' # "small", "medium", "large", "extralarge", "mega", default is medium if not included
      - name: commit changes
        continue-on-error: true
        run: |
          git config --local user.email "action@github.com"
          git config --local user.name "GitHub Action"
          git add -A
          git commit -m "Updated last.fm's weekly chart" -a

      - name: push changes
        continue-on-error: true
        uses: ad-m/github-push-action@v0.6.0
        with:
          github_token: ${{ secrets.GITHUB_TOKEN }}\
          branch: main

The cron job is scheduled to run once a day because Last.fm's API updates weekly chart data daily at 00:00, it's useless to make more than 1 request per day because you'll get the same information back every time. You can manually run the workflow in case Last.fm's API was down at the time, going to the Actions tab in your repository.

🚧 To do

  • Add the ability to decide between top charts: albums, artists, or tracks
  • Feel free to open an issue or send a pull request for anything you believe would be useful.

About

Update a markdown README.md file with a weekly chart from Last.FM

Resources

License

Stars

Watchers

Forks

Packages

 
 
 

Contributors

Languages