Fix ruff F541 and B007 lint errors

This commit is contained in:
JohnBaumb 2026-04-21 10:22:58 -07:00
parent 9863c947dc
commit a1886ed87f
2 changed files with 10 additions and 10 deletions

View file

@ -138,7 +138,7 @@ def register_routes(bp):
try: try:
# Forward to the internal sync endpoint # Forward to the internal sync endpoint
import requests as http_requests import requests as http_requests
internal_url = f"http://127.0.0.1:8008/api/sync/start" internal_url = "http://127.0.0.1:8008/api/sync/start"
resp = http_requests.post(internal_url, json={ resp = http_requests.post(internal_url, json={
"playlist_id": playlist_id, "playlist_id": playlist_id,
"playlist_name": playlist_name, "playlist_name": playlist_name,

View file

@ -279,7 +279,7 @@ class BeatportUnifiedScraper:
_beatport_log(f" Filtered out: '{name}' (appears to be a section title)") _beatport_log(f" Filtered out: '{name}' (appears to be a section title)")
else: else:
# Fallback: try the old method if no <li> elements found # Fallback: try the old method if no <li> elements found
_beatport_log(f"No <li> elements found, trying direct <a> search...") _beatport_log("No <li> elements found, trying direct <a> search...")
genre_links = menu.find_all('a', href=re.compile(r'/genre/[^/]+/\d+')) genre_links = menu.find_all('a', href=re.compile(r'/genre/[^/]+/\d+'))
if genre_links: if genre_links:
@ -492,7 +492,7 @@ class BeatportUnifiedScraper:
dj_chart_links = soup.find_all('a', href=re.compile(r'/chart/')) dj_chart_links = soup.find_all('a', href=re.compile(r'/chart/'))
individual_dj_charts = [] individual_dj_charts = []
for i, chart_link in enumerate(dj_chart_links[:10]): # Show first 10 for _i, chart_link in enumerate(dj_chart_links[:10]): # Show first 10
href = chart_link.get('href', '') href = chart_link.get('href', '')
text = chart_link.get_text(strip=True) text = chart_link.get_text(strip=True)
if text and href: if text and href:
@ -596,7 +596,7 @@ class BeatportUnifiedScraper:
_beatport_log(f" Found hero image (fallback): {fallback_src}") _beatport_log(f" Found hero image (fallback): {fallback_src}")
return fallback_src return fallback_src
_beatport_log(f" No suitable images found on page") _beatport_log(" No suitable images found on page")
return None return None
except Exception as e: except Exception as e:
@ -745,7 +745,7 @@ class BeatportUnifiedScraper:
_beatport_log(f" Found {len(track_links)} track links on {list_name}") _beatport_log(f" Found {len(track_links)} track links on {list_name}")
for i, link in enumerate(track_links[:limit]): for _i, link in enumerate(track_links[:limit]):
if len(tracks) >= limit: if len(tracks) >= limit:
break break
@ -760,7 +760,7 @@ class BeatportUnifiedScraper:
# Method 1: Look for common artist element patterns # Method 1: Look for common artist element patterns
parent = link.parent parent = link.parent
for level in range(5): # Check up to 5 parent levels for _level in range(5): # Check up to 5 parent levels
if parent: if parent:
# Try multiple artist class patterns that Beatport commonly uses # Try multiple artist class patterns that Beatport commonly uses
artist_selectors = [ artist_selectors = [
@ -921,7 +921,7 @@ class BeatportUnifiedScraper:
# Convert to our standard format # Convert to our standard format
converted_tracks = [] converted_tracks = []
for i, track_data in enumerate(release_tracks): for _i, track_data in enumerate(release_tracks):
track = self.convert_release_json_to_track_format(track_data, release_url, len(converted_tracks) + 1) track = self.convert_release_json_to_track_format(track_data, release_url, len(converted_tracks) + 1)
if track: if track:
converted_tracks.append(track) converted_tracks.append(track)
@ -1518,7 +1518,7 @@ class BeatportUnifiedScraper:
if len(tracks) > 3: if len(tracks) > 3:
_beatport_log(f" ... and {len(tracks) - 3} more tracks") _beatport_log(f" ... and {len(tracks) - 3} more tracks")
else: else:
_beatport_log(f" No tracks found") _beatport_log(" No tracks found")
except Exception as e: except Exception as e:
_beatport_log(f" Error processing release: {e}") _beatport_log(f" Error processing release: {e}")
@ -1528,8 +1528,8 @@ class BeatportUnifiedScraper:
if i < len(release_urls): if i < len(release_urls):
time.sleep(0.5) time.sleep(0.5)
_beatport_log(f"\n" + "=" * 60) _beatport_log("\n" + "=" * 60)
_beatport_log(f"SCRAPING COMPLETE") _beatport_log("SCRAPING COMPLETE")
_beatport_log(f" Total releases processed: {len(release_urls)}") _beatport_log(f" Total releases processed: {len(release_urls)}")
_beatport_log(f" Total tracks extracted: {len(all_tracks)}") _beatport_log(f" Total tracks extracted: {len(all_tracks)}")