Open
Conversation
earlier, if cmd["path"] was an url it assumed it was a yt video and prepend the ytdl:// prefix to the path for the controller. Now we skip this check and we rely on the client sending a valid (url) path for playing.
now if shared data is a valid URL it get sent straight away to the server for playing, else ytdl://ytsearch: is prefixed to the search string to performa a guess-search on yt
mcastorina
reviewed
Oct 4, 2022
Owner
mcastorina
left a comment
There was a problem hiding this comment.
Thanks for improving this feature! 🎉
Comment on lines
+171
to
+177
| // send valid url straight to server, or prepend ytdl://ytsearch for guess-searching | ||
| if (!URLUtil.isValidUrl(sharedText)) { | ||
| EditText et = (EditText) findViewById(R.id.ytsearch); | ||
| et.setText(sharedText); | ||
| sharedText = "ytdl://ytsearch:" + sharedText; | ||
| } | ||
| sendCommand(null, "play", "path", sharedText); |
Owner
There was a problem hiding this comment.
I wonder if this logic should happen on the server side. What do you think?
Contributor
Author
There was a problem hiding this comment.
Hmm.. Good point. In that case we could unify this logic with the existing logic that checks whether it's a valid file path, which is already server-side.. I think it also makes more sense, since ytdl is very much tight to the server (mpv) rather than the client. I'll make the changes
Comment on lines
+150
to
+155
| path = join(self.root, cmd["path"]) | ||
| if not isfile(path): | ||
| # not a file, perhaps a URI | ||
| if cmd["path"].startswith("ytdl://"): | ||
| ret = self.controller.play(cmd["path"]) | ||
| else: | ||
| ret, msg = False, "%s is neither a file nor a valid URI" % cmd["path"] | ||
| else: | ||
| # play the file | ||
| ret = self.controller.play(abspath(realpath(path))) | ||
| if not isfile( | ||
| path := abspath(realpath(join(self.root, cmd["path"]))) | ||
| ): | ||
| path = cmd["path"] | ||
| # play the path | ||
| ret = self.controller.play(path) |
f8e10da to
027884f
Compare
Contributor
Author
|
@mcastorina I adapted the code to do all checks server-side, can you pls review? :) |
…s/mpv-remote-app into #60_generalize_video_url
Contributor
Author
|
UP 😃 |
Owner
|
@marcopus sorry for such a long delay on this one 🙁 I will test the changes this week and if all looks good merge it. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #60