Skip to content

Extract hardcoded values to configuration file #6

@KaykCaputo

Description

@KaykCaputo

Description

Several URLs, constants, and configuration values are hardcoded throughout the codebase. These should be extracted to a configuration file for better maintainability.

Current Hardcoded Values

  • Line 144: CHUNK_SIZE = 50
  • Line 184: Search API URL https://solr.sscdn.co/cc/h2/
  • Line 236: Cifra Club URL pattern https://www.cifraclub.com.br/
  • Line 260: Chord color 44AAFF
  • Line 272: Font size dp(9)

Proposed Solution

Create a config.py file:

# config.py
class Config:
    # API Settings
    SEARCH_API_URL = "https://solr.sscdn.co/cc/h2/"
    CIFRA_CLUB_BASE_URL = "https://www.cifraclub.com.br/"
    REQUEST_TIMEOUT = 5
    SEARCH_LIMIT = 8
    
    # UI Settings
    CHUNK_SIZE = 50
    CHORD_COLOR = "44AAFF"
    LYRICS_FONT_SIZE = 9
    
    # User Agent
    USER_AGENT = "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36"

Benefits

  • Easier configuration management
  • Single source of truth
  • Simpler testing with mock configurations
  • Better for future features like theme customization

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions