Mixonomer/rename_playlist.py
2020-04-30 14:54:05 +01:00

15 lines
415 B
Python

from music.model.user import User
from music.model.playlist import Playlist
user = User.collection.filter('username', '==', 'andy').get()
name = input('enter playlist name: ')
playlist = Playlist.collection.parent(user.key).filter('name', '==', name).get()
if playlist is not None:
new_name = input('enter new name: ')
playlist.name = new_name
playlist.update()
else:
print('playlist not found')