Beispiel #1
0
        private void InitialisePlaylistFolder()
        {
            try
            {
                iPlaylists = new LocalPlaylistsRoot(iOptionSaveDirectory.Value);
            }
            catch (Exception e)
            {
                UserLog.WriteLine(DateTime.Now + ": failed to initialise local playlist folder: " + e);
                iPlaylists = null;
            }

            iWrapped.EventContentUpdated -= ContentUpdated;
            iWrapped.EventContentAdded   -= ContentAdded;
            iWrapped.EventContentRemoved -= ContentRemoved;

            if (iPlaylists != null)
            {
                iWrapped = new LocalPlaylistsRootOk(kRootId, iPlaylists);
            }
            else
            {
                iWrapped = new LocalPlaylistsRootError(kRootId);
            }

            iWrapped.EventContentUpdated += ContentUpdated;
            iWrapped.EventContentAdded   += ContentAdded;
            iWrapped.EventContentRemoved += ContentRemoved;
        }
Beispiel #2
0
        public LocalPlaylistsRootOk(string aRootId, LocalPlaylistsRoot aPlaylists)
        {
            iPlaylists = aPlaylists;
            iPlaylists.EventPlaylistAdded    += PlaylistAdded;
            iPlaylists.EventPlaylistRemoved  += PlaylistRemoved;
            iPlaylists.EventPlaylistsChanged += PlaylistsChanged;

            iMetadata            = new container();
            iMetadata.Id         = aRootId;
            iMetadata.Title      = aRootId;
            iMetadata.ChildCount = (int)iPlaylists.Count;
            iMetadata.Restricted = false;
            iMetadata.Searchable = true;
        }
Beispiel #3
0
        public LocalPlaylistSupport(HelperKinsky aHelper, LocalPlaylistFileNameGenerator aNameGenerator)
        {
            // create the options page
            OptionPage optionPage = new OptionPage("Local Playlists");

            iOptionSaveDirectory = new OptionFolderPath("playlistpath", "Local playlist path", "Path where local playlists are saved", Path.Combine(aHelper.DataPath.FullName, "Playlists"));
            optionPage.Add(iOptionSaveDirectory);
            aHelper.AddOptionPage(optionPage);

            // listen for changes to the save directory option
            iOptionSaveDirectory.EventValueChanged += SaveDirectoryChanged;

            iCreator       = new LocalPlaylistCreator(aNameGenerator);
            iRootContainer = new LocalPlaylistsRoot(iCreator, iOptionSaveDirectory);
        }