Skip to content

Fixes - #103

Closed
KDharshana wants to merge 25 commits into
PixelPlayerHQ:mainfrom
KDharshana:Fixes
Closed

Fixes#103
KDharshana wants to merge 25 commits into
PixelPlayerHQ:mainfrom
KDharshana:Fixes

Conversation

@KDharshana

Copy link
Copy Markdown

No description provided.

… case cleaner and YouTube transcript fallback
…to LRCLIB, and require synchronized lyrics only
…s all filters, fix online artist/album navigation & song count badges
…e thumbnails to 1024px HD, and implement song liking for all song types
…inz scrobbling, unified search, and modern architecture
…ne download bundling, and CI workflow runner
@KDharshana KDharshana closed this Aug 22, 2026
@greptile-apps

greptile-apps Bot commented Aug 22, 2026

Copy link
Copy Markdown

Greptile Summary

This PR adds YouTube Music authentication, extraction, library integration, streaming, and offline downloads while expanding shared search, playlists, playback, and UI behavior. It also adds a Room v5-to-v6 migration and a disk-backed cloud-stream cache.

  • Adds Innertube/NewPipe-based YouTube Music browsing and stream resolution.
  • Adds YouTube database entities, source filtering, account screens, dashboard, and shared player integration.
  • Reworks cloud proxy caching and offline download processing.
  • Adds fuzzy search, smart playlists, related UI surfaces, and extensive tests and documentation.

Confidence Score: 1/5

The PR should not merge until offline-download races, destructive YouTube collection replacement, and incomplete YouTube source filtering are fixed.

Completed offline files can still be mutated or deleted by concurrent lifecycle operations, saving a video to another YouTube collection replaces its existing membership, and multiple shared-library queries return no data for the new YouTube filter.

Files Needing Attention: app/src/main/java/com/lostf1sh/pixelplayeross/data/worker/CloudTrackDownloadWorker.kt, app/src/main/java/com/lostf1sh/pixelplayeross/data/offline/CloudOfflineRepository.kt, app/src/main/java/com/lostf1sh/pixelplayeross/data/database/YouTubeSongEntity.kt, app/src/main/java/com/lostf1sh/pixelplayeross/data/database/MusicDao.kt

Important Files Changed

Filename Overview
app/src/main/java/com/lostf1sh/pixelplayeross/data/worker/CloudTrackDownloadWorker.kt Implements resumable cloud downloads and metadata post-processing, but exposes files as complete before mutation finishes.
app/src/main/java/com/lostf1sh/pixelplayeross/data/offline/CloudOfflineRepository.kt Coordinates offline records and WorkManager jobs, but bulk cleanup races with active workers.
app/src/main/java/com/lostf1sh/pixelplayeross/data/database/YouTubeSongEntity.kt Adds cached YouTube tracks, but its primary key prevents one video from retaining multiple collection memberships.
app/src/main/java/com/lostf1sh/pixelplayeross/data/database/MusicDao.kt Extends most source filters for YouTube, while several library queries omit the new mode.
app/src/main/java/com/lostf1sh/pixelplayeross/data/stream/CloudStreamProxy.kt Adds disk caching, request validation, URL deduplication, and stale-upstream retry handling; no publishable defect was established.
app/src/main/java/com/lostf1sh/pixelplayeross/data/youtube/YouTubeRepository.kt Adds YouTube browsing, radio, library persistence, and model mapping, including the collection replacement path.
app/src/main/java/com/lostf1sh/pixelplayeross/data/database/Migrations.kt Adds the v5-to-v6 YouTube table migration consistent with the exported Room entities.

Flowchart

%%{init: {'theme': 'neutral'}}%%
flowchart LR
  YT[YouTube Music API] --> Repo[YouTube Repository]
  Repo --> DB[(Room YouTube tables)]
  Repo --> Proxy[YouTube Stream Proxy]
  Proxy --> Cache[Stream Disk Cache]
  Proxy --> Player[Media3 Player]
  Proxy --> Worker[Cloud Download Worker]
  Worker --> Offline[(Offline track files and DB)]
  Offline --> Player
  DB --> UI[Library, Search, Dashboard]
Loading

Comments Outside Diff (2)

  1. app/src/main/java/com/lostf1sh/pixelplayeross/data/worker/CloudTrackDownloadWorker.kt, line 156-165 (link)

    P1 Completion precedes file finalization

    When playback starts immediately after this update, the repository exposes the file as complete while postProcessDownloadedTrack is still rewriting it, causing truncated playback, failed seeks, or a source error.

    Prompt To Fix With AI
    This is a comment left during a code review.
    Path: app/src/main/java/com/lostf1sh/pixelplayeross/data/worker/CloudTrackDownloadWorker.kt
    Line: 156-165
    
    Comment:
    **Completion precedes file finalization**
    
    When playback starts immediately after this update, the repository exposes the file as complete while `postProcessDownloadedTrack` is still rewriting it, causing truncated playback, failed seeks, or a source error.
    
    ---
    
    For each issue above, determine whether it is valid and should be fixed. If so, fix it directly.

    Fix in Claude Code Fix in Codex

  2. app/src/main/java/com/lostf1sh/pixelplayeross/data/database/MusicDao.kt, line 920-930 (link)

    P1 YouTube filter matches no favorites

    When StorageFilter.YOUTUBE_MUSIC supplies mode 4, this predicate handles only modes 0, 1, and 2, causing the favorite count to return zero despite matching source-type 7 songs. The album and artist queries contain the same omission and therefore render those YouTube views empty as well.

    Prompt To Fix With AI
    This is a comment left during a code review.
    Path: app/src/main/java/com/lostf1sh/pixelplayeross/data/database/MusicDao.kt
    Line: 920-930
    
    Comment:
    **YouTube filter matches no favorites**
    
    When `StorageFilter.YOUTUBE_MUSIC` supplies mode 4, this predicate handles only modes 0, 1, and 2, causing the favorite count to return zero despite matching source-type 7 songs. The album and artist queries contain the same omission and therefore render those YouTube views empty as well.
    
    ---
    
    For each issue above, determine whether it is valid and should be fixed. If so, fix it directly.

    Fix in Claude Code Fix in Codex

Fix all with Greploop Fix All in Claude Code Fix All in Codex

Prompt To Fix All With AI
### Issue 1
app/src/main/java/com/lostf1sh/pixelplayeross/data/worker/CloudTrackDownloadWorker.kt:156-165
**Completion precedes file finalization**

When playback starts immediately after this update, the repository exposes the file as complete while `postProcessDownloadedTrack` is still rewriting it, causing truncated playback, failed seeks, or a source error.

### Issue 2
app/src/main/java/com/lostf1sh/pixelplayeross/data/offline/CloudOfflineRepository.kt:194-200
**Bulk cleanup deletes active downloads**

When delete-all runs during an active download or post-processing operation, this unconditionally removes every file in the shared directory without cancelling the worker, causing the download to fail or the worker to recreate orphaned files after its database row is gone.

### Issue 3
app/src/main/java/com/lostf1sh/pixelplayeross/data/database/YouTubeSongEntity.kt:21-23
**Primary key destroys collection membership**

When the same video is saved to another collection, `REPLACE` reuses this video-derived primary key and overwrites its single `playlistId`, causing the track to disappear from whichever library or favorites collection previously contained it.

### Issue 4
app/src/main/java/com/lostf1sh/pixelplayeross/data/database/MusicDao.kt:920-930
**YouTube filter matches no favorites**

When `StorageFilter.YOUTUBE_MUSIC` supplies mode 4, this predicate handles only modes 0, 1, and 2, causing the favorite count to return zero despite matching source-type 7 songs. The album and artist queries contain the same omission and therefore render those YouTube views empty as well.

### Issue 5
app/src/main/java/com/lostf1sh/pixelplayeross/data/network/youtube/InnertubeApiService.kt:63
**Direct logging bypasses release policy**

The new YouTube networking code uses `android.util.Log` throughout its request and failure paths, bypassing the repository's `ReleaseTree` filtering. Use Timber consistently here and in `YouTubeExtractorManager` so these diagnostics follow the configured release logging policy.

---

For each issue above, determine whether it is valid and should be fixed. If so, fix it directly.

Reviews (1): Last reviewed commit: "fix(playback): Stream resolution resilie..." | Re-trigger Greptile

Comment on lines +194 to +200
suspend fun deleteAllDownloaded() = withContext(Dispatchers.IO) {
val completed = dao.getCompleted()
completed.forEach { entity ->
entity.localPath?.let(::File)?.delete()
dao.deleteBySourceUri(entity.sourceUri)
}
downloadDirectory(context).listFiles()?.forEach(File::delete)

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P1 Bulk cleanup deletes active downloads

When delete-all runs during an active download or post-processing operation, this unconditionally removes every file in the shared directory without cancelling the worker, causing the download to fail or the worker to recreate orphaned files after its database row is gone.

Prompt To Fix With AI
This is a comment left during a code review.
Path: app/src/main/java/com/lostf1sh/pixelplayeross/data/offline/CloudOfflineRepository.kt
Line: 194-200

Comment:
**Bulk cleanup deletes active downloads**

When delete-all runs during an active download or post-processing operation, this unconditionally removes every file in the shared directory without cancelling the worker, causing the download to fail or the worker to recreate orphaned files after its database row is gone.

---

For each issue above, determine whether it is valid and should be fixed. If so, fix it directly.

Fix in Claude Code Fix in Codex

Comment on lines +21 to +23
@PrimaryKey val id: String,
@ColumnInfo(name = "video_id") val videoId: String,
@ColumnInfo(name = "playlist_id") val playlistId: String = "__library__",

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P1 Primary key destroys collection membership

When the same video is saved to another collection, REPLACE reuses this video-derived primary key and overwrites its single playlistId, causing the track to disappear from whichever library or favorites collection previously contained it.

Prompt To Fix With AI
This is a comment left during a code review.
Path: app/src/main/java/com/lostf1sh/pixelplayeross/data/database/YouTubeSongEntity.kt
Line: 21-23

Comment:
**Primary key destroys collection membership**

When the same video is saved to another collection, `REPLACE` reuses this video-derived primary key and overwrites its single `playlistId`, causing the track to disappear from whichever library or favorites collection previously contained it.

---

For each issue above, determine whether it is valid and should be fixed. If so, fix it directly.

Fix in Claude Code Fix in Codex

userPreferencesRepository.youTubeAuthCookiesFlow.collect { cookies ->
authCookies = cookies
val sapisid = cookies?.let { extractCookieValue(it, "SAPISID") ?: extractCookieValue(it, "__Secure-3PAPISID") }
android.util.Log.d("YouTubeMusic", "InnertubeApiService updated authCookies (length=${cookies?.length ?: 0}, hasSapisid=${!sapisid.isNullOrBlank()})")

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Direct logging bypasses release policy

The new YouTube networking code uses android.util.Log throughout its request and failure paths, bypassing the repository's ReleaseTree filtering. Use Timber consistently here and in YouTubeExtractorManager so these diagnostics follow the configured release logging policy.

Context Used: CONTRIBUTING.md (source)

Prompt To Fix With AI
This is a comment left during a code review.
Path: app/src/main/java/com/lostf1sh/pixelplayeross/data/network/youtube/InnertubeApiService.kt
Line: 63

Comment:
**Direct logging bypasses release policy**

The new YouTube networking code uses `android.util.Log` throughout its request and failure paths, bypassing the repository's `ReleaseTree` filtering. Use Timber consistently here and in `YouTubeExtractorManager` so these diagnostics follow the configured release logging policy.

**Context Used:** CONTRIBUTING.md ([source](https://github.com/pixelplayerhq/pixelplayeross/blob/main/CONTRIBUTING.md))

---

For each issue above, determine whether it is valid and should be fixed. If so, fix it directly.

Note: If this suggestion doesn't match your team's coding style, reply to this and let me know. I'll remember it for next time!

Fix in Claude Code Fix in Codex

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.

2 participants