This repository was archived by the owner on May 12, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1
Naming playlists #8
Open
tfiedlerdejanze
wants to merge
7
commits into
master
Choose a base branch
from
rename-playlists
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Conversation
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
mroach
reviewed
Apr 7, 2019
ui/lib/musicbox/player.ex
Outdated
| end | ||
| end | ||
|
|
||
| defp extract_playlist_name(name) do |
Owner
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.
How about something like this where you can extract the name and ID in one go? Then we don't need any temporary indicators like # in strings. We can just extract the ID and name, then generate the new names straight away with "#{id} - #{name}"
re = ~r/\A(?<id>\d+)(?:\W+(?<name>.+))?\z/
iex> Regex.named_captures(re, "123456 - dope tunes")
%{"id" => "123456", "name" => "dope tunes"}
iex> Regex.named_captures(re, "1234")
%{"id" => "1234", "name" => ""}
iex> Regex.named_captures(re, "derp")
nil
tfiedlerdejanze
commented
Apr 7, 2019
| |> Regex.named_captures(playlist) | ||
| |> case do | ||
| %{"tag_id" => tag_id} -> tag_id | ||
| case Musicbox.Player.playlist_information(playlist) do |
Collaborator
Author
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.
Probably time for the extra Playlist module. But it works as is
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
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.
Some ugly string manipulation to name and rename playlists with Paracusia. It misses a commit for reading the card id (that obviously does not change when renaming the playlist). I'll add that as well as some styling for this 😬
With some extra key value storage we could probably just add a name to the playlist, without changing the id of the .m3u file and therefore not breaking the cards. If you have some thoughts on that, let me know :)