My videos, album management, add/remove to video albums

This commit is contained in:
2016-08-14 07:46:41 -05:00
parent 4ae167e461
commit 4900b67882
8 changed files with 217 additions and 10 deletions

View File

@@ -2,22 +2,26 @@
import widgetUtils
from wxUI.dialogs import selector as gui
class audioAlbum(object):
class album(object):
def __init__(self, title, session):
super(audioAlbum, self).__init__()
def __init__(self, title, session, album_type="audio_albums"):
super(album, self).__init__()
self.item = None
self.session = session
if not hasattr(self.session, album_type):
return
self.albums = getattr(self.session, album_type)
self.dialog = gui.selectAlbum(title=title, albums=self.get_albums_as_string())
response = self.dialog.get_response()
if response == widgetUtils.OK:
self.item = self.search_item(self.dialog.get_string())
def get_albums_as_string(self):
return [i["title"] for i in self.session.audio_albums]
return [i["title"] for i in self.albums]
def search_item(self, item):
for i in self.session.audio_albums:
for i in self.albums:
if i["title"] == item:
return i["id"]
return None