Skip to content

Add commands for external playlist management - #1297

Merged
flyingmutant merged 9 commits into
cmus:masterfrom
rodenet-hier:pl_management
Nov 4, 2023
Merged

flyingmutant merged 9 commits into
cmus:masterfrom
rodenet-hier:pl_management

Conversation

@rodenet-hier

Copy link
Copy Markdown
Contributor

This PR implements the commands "pl-delete" and "pl-delete-all" that remove playlists for use with cmus-remote.

Other playlist management functionality needs further design discussion but these commands should be sufficient if all playlists are managed externally (which is my use case).

Partially addresses #1066

Comment thread pl.c Resolved
Comment thread pl.c Resolved
Comment thread command_mode.c Resolved
@rodenet-hier

Copy link
Copy Markdown
Contributor Author

All done

Comment thread Doc/cmus.txt Resolved
Comment thread pl.c Outdated
if (list_len(&pl_head) == 1) {
last = pl;
break;
}

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Can this special case for the last item be removed now?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

I've tested the code without that block and it was working but I'm not entirely sure how the list functions with additions inside the loop so I didn't want to risk an infinite loop. I could remove it if it's fine. I removed the "last" variable with 68d9b0b for now.

Comment thread pl.c
struct playlist *temp;
list_for_each_entry_safe(pl, temp, &pl_head, node) {
if (list_len(&pl_head) == 1)
break;

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Still not getting this, won't the for_each loop just end naturally when all the items are gone?

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Wait I get it, because we add back the default 😁

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Yeah it could still be fine but I couldn't really wrap my head around the implementation too well to confirm it.

@flyingmutant
flyingmutant merged commit 22ef296 into cmus:master Nov 4, 2023
@flyingmutant

Copy link
Copy Markdown
Member

Thanks!

@rodenet-hier

Copy link
Copy Markdown
Contributor Author

Thank you both as well for your time

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.

3 participants