Exemple #1
0
 public ArtistModule(IServiceProvider provider)
 {
     _SS  = provider.GetService <SandwichService>();
     _DB  = provider.GetService <SandwichDatabase>();
     _ADB = provider.GetService <ArtistDatabase>();
     _LDB = provider.GetService <ListingDatabase>();
     _UDB = provider.GetService <UserDatabase>();
 }
 public BroadcastModule(IServiceProvider provider)
 {
     _SS  = provider.GetService <SandwichService>();
     _DB  = provider.GetService <SandwichDatabase>();
     _ADB = provider.GetService <ArtistDatabase>();
     _LDB = provider.GetService <ListingDatabase>();
     _UDB = provider.GetService <UserDatabase>();
     // _TDB = provider.GetService<TipDatabase>();
     _BDB = provider.GetService <BroadcastDatabase>();
 }
        // GET: Artist
        public ActionResult Index(string artist)
        {
            var singleArtist = ArtistDatabase.Find(p => p.Name == artist);

            if (singleArtist == null)
            {
                return(View(ArtistDatabase));
            }

            return(View("ArtistProfile", singleArtist));
        }
Exemple #4
0
        public async Task Install(IServiceProvider provider)
        {
            _provider = provider;
            client    = _provider.GetService <DiscordSocketClient>();
            commands  = _provider.GetService <CommandService>();
            _udb      = _provider.GetService <UserDatabase>();
            _adb      = _provider.GetService <ArtistDatabase>();
            await commands.AddModulesAsync(Assembly.GetEntryAssembly());

            client.MessageReceived += HandleCommand;
        }
        public override Task <PreconditionResult> CheckPermissions(ICommandContext context, CommandInfo command, IServiceProvider provider)
        {
            SandwichService SandwichService = provider.GetService <SandwichService>();
            ArtistDatabase  Artistdatabase  = provider.GetService <ArtistDatabase>();


            var user = context.User as SocketGuildUser;

            if (user == null)
            {
                return(Task.FromResult(PreconditionResult.FromError("The command was not used in a guild.")));
            }

            string[] roleNames = { "manager", "server administrator", "owner" };

            var matchingRoles = context.Guild.Roles.Where(role => roleNames.Any(name => name == role.Name.ToLower()));

            if (matchingRoles == null)
            {
                return(Task.FromResult(PreconditionResult.FromError("There are no matching roles on the server.")));
            }

            if (user.Roles.Any(role => matchingRoles.Contains(role)))
            {
                Artist a = Artistdatabase.Artists.FirstOrDefault(x => x.ArtistId == context.User.Id);
                if (a != null)
                {
                    if (a.canBlacklist)
                    {
                        return(Task.FromResult(PreconditionResult.FromSuccess()));
                    }
                    else
                    {
                        return(Task.FromResult(PreconditionResult.FromError("You do not have the ability to blacklist, which is required for this command to run.")));
                    }
                }
                else
                {
                    return(Task.FromResult(PreconditionResult.FromError("You are not registered as a Sandwich Artist!")));
                }
            }

            return(Task.FromResult(PreconditionResult.FromError("You do not have either the Senate, Admin or God Sandwich Artist role..")));
        }
Exemple #6
0
        public async Task StartIndexing()
        {
            _artistDatabase.Drop();
            _trackDatabase.Drop();
            _albumDatabase.Drop();

            await DispatchHelper.InvokeAsync(() =>
            {
                Locator.MainVM.InformationText = "Searching for music";
                IsBusy   = true;
                IsLoaded = false;
                OnPropertyChanged("IsBusy");
                OnPropertyChanged("IsLoaded");
            });

            _artistDatabase = new ArtistDatabase();
            _artistDatabase.Initialize();
            _trackDatabase.Initialize();
            _albumDatabase.Initialize();

            await MusicLibraryManagement.DoRoutineMusicLibraryCheck();

            await LoadFromDatabase();

            await App.Dispatcher.RunAsync(CoreDispatcherPriority.Normal, () =>
            {
                IsBusy              = false;
                IsLoaded            = true;
                IsMusicLibraryEmpty = false;
                OnPropertyChanged("Artists");
                OnPropertyChanged("FavoriteAlbums");
                OnPropertyChanged("IsBusy");
                OnPropertyChanged("IsMusicLibraryEmpty");
                OnPropertyChanged("IsLoaded");
                LoadingState = LoadingState.Loaded;
                Locator.MainVM.InformationText = "";
            });

            await GetFavoriteAndRandomAlbums();
        }