-
Notifications
You must be signed in to change notification settings - Fork 381
Display id instead of error if songs already exists #857
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
base: master
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -11,10 +11,8 @@ | |
| exit("Invalid captcha response"); | ||
|
|
||
| $result = $gs->songReupload($_POST['songlink']); | ||
| if($result == "-4"){ | ||
| if($result == "-4") | ||
| echo "This URL doesn't point to a valid audio file."; | ||
| }elseif($result == "-3") | ||
| echo "This song already exists in our database."; | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. If the song exists in the database, it still returns the "song uploaded" message with the ID. It may be confusing. Consider adding "song already exists" but still returning the ID of the already uploaded song.
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I also thought about this, but the problem is about concept of this "API". It (mainlib function) is expected to return an integer where if > 0 then it is id, if <= 0 assume it failed. We should ask @Cvolton about designing this
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It still removes the capability of the error text "This song already exists in our database." Yes, your code still returns the ID of the song, very well but removing the existing error still be confusable. I guess we need @Cvolton's opinion on that. |
||
| elseif($result == "-2") | ||
| echo "The download link isn't a valid URL"; | ||
| else | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Your code lacks the song existence check.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I am not a good PHPer, but
$id != falseshould do the trickThere was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I see no issues with your code.