public void FillIP(String myip)
        {
            _ip = myip;
            // Check if id exist

            using (var musik = new musikindexEntities())
            {
                List<string> ips = (from p in musik.devices select p.idIP).ToList();

                bool check = false;
                foreach (var oldip in ips)
                {
                    if (oldip == myip)
                        check = true;

                }
                var mynewip = new device();
                mynewip.idIP = myip;
                mynewip.Owner = Environment.UserName;
                mynewip.Protocol = "rtsp://";
                mynewip.Catagory_idCatagory = 1;

                if (!check)
                {

                    musik.devices.Add(mynewip);
                    musik.SaveChanges();

                }

            }
        }
        public void addNumtoplayquque(int num)
        {
            var mummer = new playqueue();

            mummer.Catagory_idCatagory = 3;
            mummer.MusikData_idMusikData = num;

            using (var musik = new musikindexEntities())
            {
                musik.playqueues.Add(mummer);
                musik.SaveChanges();

            }
        }
        private void Buttonremoveall_OnClick(object sender, RoutedEventArgs e)
        {
            using (var musik = new musikindexEntities())
            {
                musik.Database.Delete();

            }
        }
        public void fillMusicdata(List<IMetadataReader> datalist)
        {
            var nummer = new musikdata();

            using (var musik = new musikindexEntities())
            {

                foreach (var metadata in datalist)
                {
                    nummer.Title = metadata.Title;
                    nummer.Artist_idArtist = metadata.Artist;
                    nummer.Album_idAlbum = metadata.Album;
                    nummer.Genre_Genre = metadata.Genre;
                    nummer.NrLenth = metadata.LengthS;
                    nummer.FileName = metadata.ItemName;
                    nummer.FilePath_idFilePath = "chomefuck";//

                    musik.musikdatas.Add(nummer);

                    musik.SaveChanges();
                }

            }
        }
        private void Addgenre( List<string> liste)
        {
            //se if Genre exists if not add genre
            using (var musik = new musikindexEntities())
            {
                List<string> list2 = (from p in musik.genres

                                         select p.Genre1

                                        ).ToList();

                liste = listcompair(liste, list2);

                if (liste.Count >= 1)
                {

                    foreach (var onpath in liste)
                    {
                        var _genre = new genre();
                        _genre.Genre1 = onpath;
                        _genre.Musik_Catagory_idCatagory = 3;

                        musik.genres.Add(_genre);
                        musik.SaveChanges();

                    }

                }
            }
        }
        private void addArtist(List<string> liste)
        {
            // make artist list

            using (var musik = new musikindexEntities())
            {
                List<string> list2 = (from p in musik.artists

                                      select p.idArtist

                                        ).ToList();

                liste = listcompair(liste, list2);

                if (liste.Count >= 1)
                {

                    foreach (var onpath in liste)
                    {
                        var entity = new artist();
                        entity.idArtist = onpath;
                        entity.Musik_Catagory_idCatagory = 1;

                        musik.artists.Add(entity);
                        musik.SaveChanges();

                    }

                }
            }
        }
        private void addAlbum(List<string> liste)
        {
            using (var musik = new musikindexEntities())
            {
                List<string> list2 = (from p in musik.albums

                                      select p.idAlbum

                                        ).ToList();

                liste = listcompair(liste, list2);

                if (liste.Count >= 1)
                {

                    foreach (var onpath in liste)
                    {
                        var entity = new album();
                        entity.idAlbum = onpath;
                        entity.Musik_Catagory_idCatagory = 2;

                        musik.albums.Add(entity);
                        musik.SaveChanges();

                    }

                }
            }
        }
        public void FillPath(List<string> PathOndevice)
        {
            using (var musik = new musikindexEntities())
            {
                List<string> pathlist = (from p in musik.filepaths
                                         //where p.IP_idIP == "192.168.001.090"
                                         where p.IP_idIP == _ip
                                         select p.idFilePath

                                        ).ToList();

                PathOndevice = listcompair(PathOndevice, pathlist);

                if (PathOndevice.Count >= 1)
                {

                    foreach (var onpath in PathOndevice)
                    {
                        var path = new filepath();
                        path.idFilePath = onpath;
                        path.IP_idIP = _ip;

                        musik.filepaths.Add(path);
                        musik.SaveChanges();

                    }

                }

            }
            //see if pathes is allready is assigned to ip
            // if not add pathes
        }