2022-11-30 00:09:23 -08:00
|
|
|
from .base import BasePrompt
|
|
|
|
|
|
|
|
from slugify import slugify
|
|
|
|
|
|
|
|
from groove.playlist import Playlist
|
|
|
|
|
|
|
|
|
2022-12-02 00:21:19 -08:00
|
|
|
class load(BasePrompt):
|
2022-11-30 00:09:23 -08:00
|
|
|
"""Create a new playlist."""
|
|
|
|
|
|
|
|
@property
|
|
|
|
def usage(self):
|
2022-12-02 00:21:19 -08:00
|
|
|
return "load PLAYLIST_NAME"
|
2022-11-30 00:09:23 -08:00
|
|
|
|
|
|
|
def process(self, cmd, *parts):
|
|
|
|
name = ' '.join(parts)
|
|
|
|
if not name:
|
|
|
|
print(f"Usage: {self.usage}")
|
|
|
|
return
|
|
|
|
slug = slugify(name)
|
|
|
|
self.parent._playlist = Playlist(
|
|
|
|
slug=slug,
|
|
|
|
name=name,
|
|
|
|
session=self.manager.session,
|
2022-12-02 00:21:19 -08:00
|
|
|
create_ok=True
|
2022-11-30 00:09:23 -08:00
|
|
|
)
|
2022-12-02 00:21:19 -08:00
|
|
|
print(self.parent.playlist.summary)
|
2022-11-30 00:09:23 -08:00
|
|
|
return self.parent.commands['_playlist'].start()
|