这是indexloc提供的服务,不要输入任何密码
Skip to content

Conversation

Copy link
Contributor

Copilot AI commented Jul 4, 2025

This PR implements filtering to exclude songs containing "TODO" from the song collection, as there is no need to add incomplete songs to the database.

Changes Made

  • Added song_contains_todo() function: Checks all song fields (name, melody, composer, arranger, lyrics, notes) for "TODO" content
  • Modified extraction logic: Songs with TODO in any field are now filtered out before being added to songs.json
  • Added comprehensive tests: 9 test cases covering all song fields and edge cases

Implementation Details

The filtering is implemented in extract_songs.py with minimal code changes:

def song_contains_todo(song: SongInfo) -> bool:
    """Check if a song contains 'TODO' in any of its fields."""
    fields_to_check = [
        song.name, song.melody, song.composer, 
        song.arranger, song.lyrics, song.notes
    ]
    
    for field in fields_to_check:
        if field and "TODO" in field:
            return True
    
    return False

The filter is applied in the main extraction loop:

if song.name != "Parse Error":
    # Filter out songs that contain TODO in any field
    if not song_contains_todo(song):
        songs.append(asdict(song))

Testing

  • ✅ All unit tests pass (9/9)
  • ✅ Integration testing confirms TODO songs are excluded
  • ✅ Backwards compatibility maintained
  • ✅ No syntax or compilation errors

The implementation is case-sensitive and safely handles None values in song fields.

Fixes #5.


💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.

Copilot AI and others added 2 commits July 4, 2025 16:08
Co-authored-by: ApsiV11 <47868046+ApsiV11@users.noreply.github.com>
Co-authored-by: ApsiV11 <47868046+ApsiV11@users.noreply.github.com>
Copilot AI changed the title [WIP] Filter songs that have TODO in them Filter songs that contain TODO from collection Jul 4, 2025
Copilot AI requested a review from ApsiV11 July 4, 2025 16:10
Copilot finished work on behalf of ApsiV11 July 4, 2025 16:10
@@ -0,0 +1,122 @@
#!/usr/bin/env python3
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Remove this whole file. I don't need tests

Co-authored-by: ApsiV11 <47868046+ApsiV11@users.noreply.github.com>
Copilot AI requested a review from ApsiV11 July 4, 2025 16:13
Copilot finished work on behalf of ApsiV11 July 4, 2025 16:13
import os

# WHITELIST = ("eino", "")
WHITELIST = ("",)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This file isnt formatted properly

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed the formatting issues by consolidating the misplaced imports and running Black formatter. All imports are now properly organized at the top of the file. (415c94a)

…atter

Co-authored-by: ApsiV11 <47868046+ApsiV11@users.noreply.github.com>
Copilot AI requested a review from ApsiV11 July 4, 2025 16:22
Copilot finished work on behalf of ApsiV11 July 4, 2025 16:22
Copy link
Member

@ApsiV11 ApsiV11 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice work!

@ApsiV11 ApsiV11 marked this pull request as ready for review July 4, 2025 16:26
@ApsiV11 ApsiV11 merged commit faf1a99 into main Jul 4, 2025
5 of 6 checks passed
@ApsiV11 ApsiV11 deleted the copilot/fix-5 branch July 5, 2025 15:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Filter songs that have TODO in them

2 participants