Skip to content

Folders and files

NameName
Last commit message
Last commit date

Latest commit

ย 

History

10 Commits
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 

Repository files navigation

๐ŸŽต HitIT โ€” Music Game

A music guessing game with Jellyfin and Spotify integration. Guess the year, pick songs by genre/decade, or play in multiplayer mode!

๐ŸŒ Now fully multilingual! Available in English and German, with easy support for adding more languages. Learn more โ†’

๐ŸŽฎ Play Online โ†’ (Requires your own API keys - stored locally in browser only, never on server) | ๐Ÿ’ฌ Discussions | ๐Ÿ“ License

๐Ÿ“‹ Requirements

Hard Dependencies (Required)

  • Web Server โ€” to serve static files (CORS support needed)
    • Python 3.6+ built-in server (recommended)
    • OR Node.js http-server
    • OR any other static file server
  • Modern Browser โ€” with ES modules support (Chrome, Firefox, Safari, Edge)

Soft Dependencies (Optional)

  • Music Source โ€” at least one of:
    • Jellyfin server with API access
    • Spotify Premium account
  • Last.fm API key โ€” for enhanced metadata (covers, lyrics, tags)

๐Ÿš€ Quick Start

1. Start the server

./start.sh

Or start manually:

python3 start_server.py

2. Open in your browser

โš ๏ธ IMPORTANT: For local use with the Spotify API, the app must run at http://127.0.0.1:8080/. Add exactly this URL as a redirect URI in the Spotify dashboard. Some Spotify flows differentiate between localhost and 127.0.0.1.

http://127.0.0.1:8080/

3. Configure music source

Open the hamburger menu (โ˜ฐ) โ†’ Settings

Option A: Jellyfin (recommended for local music)

  1. Music source: Jellyfin
  2. Configure server URL, Library ID, and API Key
  3. Save โ†’ status should turn green โœ…

Detailed guide: JELLYFIN_SETUP.md

Option B: Spotify (for streaming)

  1. Music source: Spotify
  2. Configure Client ID
  3. Save
  4. Click "Connect with Spotify"
  5. Authorize in browser โ†’ redirect back
  6. Status should turn green โœ…

Detailed guide: SPOTIFY_SETUP.md

Optional: Last.fm (enhanced metadata)

  • Add Last.fm API key in Settings
  • Enriches songs with cover art, lyrics, and tags
  • No account login required, just API key

Detailed guide: LASTFM_SETUP.md

๐ŸŽฎ Game Modes

๐ŸŽถ Choose a Song

Pick a random song by genre and time period. Perfect for discovering music or party playlists!

Filters:

  • Genre (e.g. "Rock", "Pop", "Game")
  • Min/Max year (e.g. 1990โ€“1999)
  • Artist (e.g. Soundgarden)

๐Ÿง  Guess the Year

Guess a songโ€™s release year! You have 3 lives and a running timer.

Scoring:

  • ยฑ0 years = 5 points
  • ยฑ1 year = 3 points
  • ยฑ2 years = 2 points
  • ยฑ3+ years = 0 points (life -1)

Hints available:

  • Title, artist, album (reveal buttons)

๐Ÿ† Multiplayer Timeline

Place cards chronologically, similar to popular music timeline games!

Flow:

  1. Each player starts with 1 card
  2. Draw a new card and play the song
  3. Decide the songโ€™s time placement
  4. Correct โ†’ card is placed in the deck
  5. Wrong โ†’ card is discarded
  6. First to 10 cards (configurable) wins ๐ŸŽ‰

Setup:

  • Player count (2โ€“6)
  • Target deck size
  • Genre/year filters (optional)

๐Ÿ“ Project Structure

HitIT/
โ”œโ”€โ”€ index.html                  # Main UI
โ”œโ”€โ”€ app.js                      # Legacy helpers & multiplayer glue
โ”œโ”€โ”€ main.js                     # Bootstrap / entry wiring modules
โ”œโ”€โ”€ freestyler.css              # Global styles
โ”œโ”€โ”€ start_server.py             # Local dev server (127.0.0.1 binding)
โ”œโ”€โ”€ start.sh                    # Convenience launcher
โ”œโ”€โ”€ README.md                   # Project overview
โ”œโ”€โ”€ SETUP.md                    # Detailed environment setup
โ”œโ”€โ”€ SECURITY.md                 # Security & deployment guide
โ”œโ”€โ”€ JELLYFIN_SETUP.md           # Jellyfin configuration guide
โ”œโ”€โ”€ SPOTIFY_SETUP.md            # Spotify OAuth setup (PKCE)
โ”œโ”€โ”€ LASTFM_SETUP.md             # Last.fm metadata integration
โ”œโ”€โ”€ I18N.md                     # Internationalization guide
โ””โ”€โ”€ src/
   โ”œโ”€โ”€ config.js               # Runtime config (selected source, server URLs)
   โ”œโ”€โ”€ i18n/                   # Internationalization system
   โ”‚   โ”œโ”€โ”€ i18n.js             # Core translation engine
   โ”‚   โ””โ”€โ”€ locales/            # Language files (en.js, de.js, template.js)
   โ”œโ”€โ”€ state/
   โ”‚   โ””โ”€โ”€ gameState.js        # Central game state (scores, lives, active song)
   โ”œโ”€โ”€ services/               # External + domain services
   โ”‚   โ”œโ”€โ”€ jellyfinClient.js   # Jellyfin REST client
   โ”‚   โ”œโ”€โ”€ lastfmClient.js     # Last.fm metadata enrichment
   โ”‚   โ”œโ”€โ”€ musicService.js     # High-level abstraction over sources
   โ”‚   โ”œโ”€โ”€ songService.js      # Filtering & year extraction logic
   โ”‚   โ”œโ”€โ”€ spotifyClient.js    # Spotify OAuth + Web API calls
   โ”‚   โ””โ”€โ”€ spotifyPlayer.js    # Spotify playback integration
   โ”œโ”€โ”€ modes/                  # Game mode controllers
   โ”‚   โ”œโ”€โ”€ chooseMode.js       # "Choose a Song" mode logic
   โ”‚   โ”œโ”€โ”€ guessGame.js        # "Guess the Year" mode logic
   โ”‚   โ””โ”€โ”€ multiplayerController.js  # Timeline/multiplayer logic
   โ”œโ”€โ”€ ui/                     # UI-specific helpers/components
   โ””โ”€โ”€ utils/
       โ””โ”€โ”€ audio.js            # Audio autoplay utility

๐Ÿ”ง Features

โœ… Multi-source support

  • Jellyfin (local music, full-length)
  • Spotify (streaming, 30s previews)

โœ… Multilingual interface ๐ŸŒ

  • English and German fully supported
  • Easy to add new languages
  • Language switcher in Settings
  • Learn more โ†’

โœ… OAuth 2.0 PKCE

  • Secure login without client secret
  • Session-based (no persistent storage)

โœ… Modular architecture

  • ES modules
  • Service layer (Jellyfin/Spotify)
  • Mode controller (Choose/Guess/Multiplayer)

โœ… Mobile responsive

  • Swipe navigation in multiplayer
  • Hamburger menu
  • Adaptive layouts

โœ… Privacy-first

  • No credentials in source code
  • localStorage only for config (server URLs)
  • sessionStorage for tokens (auto-expire)

โš ๏ธ Spotify Limitations

Spotify Premium required! Spotify's Web API rarely provides usable 30s preview_url values; most tracks return null. Reliable full-length playback requires the Web Playback SDK and a Spotify Premium account (scopes: streaming, user-modify-playback-state). For a consistent experience:

  • Prefer Jellyfin for full-length local playback
  • Use Spotify only with Premium subscription
  • Without Premium, most tracks will have no audio

The app uses the Web Playback SDK for Premium accounts.

๐Ÿ› ๏ธ Development

Requirements

  • Python 3.6+ (for dev server)
  • Modern browser with ES module support

Local server

# With the built-in script (recommended)
./start.sh

# Or manually with Python
python3 start_server.py

# Or with Node.js
npx http-server -p 8080 -a 127.0.0.1

Debugging

  • Browser DevTools (F12)
  • Network Tab fรผr API-Requests
  • Console fรผr Logs & Fehler

Important for Spotify OAuth:

  • URL must be http://127.0.0.1:8080/
  • Server must bind to 127.0.0.1
  • Add the redirect URI exactly like this in the Spotify dashboard

๐Ÿ“ Advanced Configuration

For detailed configuration of each service, see the dedicated setup guides:

  • JELLYFIN_SETUP.md โ€” Server URL, Library ID, API key creation, CORS setup
  • SPOTIFY_SETUP.md โ€” Client ID, OAuth flow, redirect URI configuration
  • LASTFM_SETUP.md โ€” API key creation, metadata enrichment
  • I18N.md โ€” Adding new languages, translation system
  • SETUP.md โ€” Detailed environment setup
  • SECURITY.md โ€” Security best practices, deployment guidelines

๐ŸŽจ Customization

Themes / CSS

Edit freestyler.css:

  • CSS variables for colors
  • Media queries for responsiveness
  • Animations & transitions

Game rules

  • src/state/gameState.js โ†’ DEFAULT_LIVES, timer duration
  • src/modes/guessGame.js โ†’ scoring logic (applyScoring)
  • app.js โ†’ multiplayer target deck size (mpTargetStreak)

New modes

  1. Create src/modes/newMode.js
  2. Export functions
  3. Import in main.js or app.js
  4. Add buttons in index.html

๐Ÿ› Troubleshooting

Spotify: "INVALID_CLIENT"

Problem: Server runs at the wrong address

Solution:

# Stop server
pkill -f start_server.py || true

# Restart (binds to 127.0.0.1)
./start.sh

# Open in browser
xdg-open http://127.0.0.1:8080/ || echo "Open in your browser: http://127.0.0.1:8080/"

Ensure the Spotify dashboard redirect URI is exactly http://127.0.0.1:8080/.

Jellyfin: "No songs found"

Common issues:

  • Server URL incorrect (must start with https://)
  • Wrong library ID
  • Invalid API key

Solution: Open settings โ†’ check status (should be green)

Audio doesnโ€™t play

Spotify:

  • Only 30s previews available
  • Some tracks have no preview โ†’ no audio

Jellyfin:

  • CORS errors? โ†’ configure Jellyfin CORS headers
  • API key expired? โ†’ generate a new key

Mobile: layout broken

Solution:

  • Hard reload: Ctrl+Shift+R (desktop) / clear cache (mobile)
  • Reset browser zoom (100%)

๐Ÿ“œ License

Project for private/educational use. Jellyfin & Spotify trademarks belong to their respective owners.

๐Ÿ™ Credits

  • Inspired by music timeline guessing games
  • Jellyfin for local media server integration
  • Spotify Web API for streaming support

Enjoy guessing music! ๐ŸŽ‰๐ŸŽถ

About

No description, website, or topics provided.

Resources

Security policy

Stars

0 stars

Watchers

1 watching

Forks

Releases

Packages

Contributors

Languages