Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Any way to save youtube downloaded files? #173

Open
surtarso opened this issue Nov 11, 2024 · 1 comment
Open

Any way to save youtube downloaded files? #173

surtarso opened this issue Nov 11, 2024 · 1 comment

Comments

@surtarso
Copy link

Hi there Arthur, I think I found a bug.
I saved some youtube music as a favorite stream, and they did work for a while (I guess till the temp file is deleted?).
Today I wanted to hear the saved things and none of them work, they dont even get added to the playlist when you go to favorites and click play on a saved stream (coming from youtube). I had the impression it would re-download and work but it didn't.

On that count, is there a way maybe we can add a "youtube tracks" folder or something on our music collection and have an option to save some tunes there, the ones found thru youtube searches?
It kinda feels like a waste of bandwidth to re-download the same song over and over, and kinda silly to download it manually to add to ompd since it already does that.
Thanks!

ArturSierzant added a commit that referenced this issue Nov 13, 2024
New skin (modified ompd_darker)
Fixed YouTube track from Favorites not playing (#173)
@ArturSierzant
Copy link
Owner

Hi Surtarso,

actually YT files are not downloaded - they are streamed from YT. O!MPD gets address of stream using youtube-dl (I use yt-dlp) and sends it to mpd.

URL saved in Favorites looks like this:

http://192.168.1.243/ompd/stream.php?action=streamYouTube&track_id=HG7I4oniOyA&ompd_title=Why+%28Official+Music+Video%29&ompd_duration=293&ompd_artist=Annie+Lennox&ompd_thumbnail=https%3A%2F%2Fi.ytimg.com%2F%2Fvi%2FHG7I4oniOyA%2Fmaxresdefault.jpg&ompd_year=2009&ompd_webpage=http%3A%2F%2Fwww.youtube.com%2Fwatch%3Fv%3DHG7I4oniOyA

This URL is added to mpd playlist (you can see it using mpc playlist). It contains all information O!MPD needs to correctly display track in NowPlaying (like artist name, track title, cover, etc.) without connecting to YT. When mpd tries to play this track, it sends this URL to O!MPD server (in my case 192.168.1.243) which gets (using youtube-dl) URL of YT audio stream. Next this URL is send back to mpd and music plays.

The problem I see is when one changes address of O!MPD server after adding a track to Favorites - then mpd will try to connect with unavailable address and playback will fail. Maybe it is your case - considering what you described in #172. This need to be corrected - I'll try to do it.

I also found a bug in getYouTubeStreamUrl($url) function - preg_match_all was used instead of preg_match. It caused error in getting stream URL from YT and track wasn't played by mpd even though it was properly displayed in O!MPD. I fixed it in 574d470.

Thanks for reporting this issue.

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

No branches or pull requests

2 participants