Esempio n. 1
0
 public void Insert(Release release)
 {
     cmdRelease["id"]             = release.Id;
     cmdRelease["master_id"]      = release.MasterId;
     cmdRelease["status"]         = release.Status.ToString();
     cmdRelease["title"]          = release.Title;
     cmdRelease["joined_artists"] = release.Aggregate.JoinedArtistsFixed;
     cmdRelease["country"]        = release.Country ?? "";
     cmdRelease["releasedate"]    = release.ReleaseDate ?? "";
     cmdRelease["notes"]          = release.Notes ?? "";
     cmdRelease.Execute();
     this.InsertReleaseArtists(release, release.Id, 0);
     this.InsertReleaseFormats(release, release.Id);
     if (release.Genres != null)
     {
         this.InsertReleaseGenres(release, release.Id, 0);
     }
     if (release.Images != null)
     {
         this.InsertReleaseImages(release, release.Id, 0);
     }
     if (release.Labels != null)
     {
         this.InsertReleaseLabels(release, release.Id);
     }
     if (release.Identifiers != null)
     {
         this.InsertReleaseIdentifiers(release, release.Id);
     }
     if (release.Styles != null)
     {
         this.InsertReleaseStyles(release, release.Id, 0);
     }
     this.InsertReleaseTracks(release, release.Id, 0);
 }
Esempio n. 2
0
        public void Insert(Label label)
        {
            cmdInsertLabel["name"]        = label.Name;
            cmdInsertLabel["contactinfo"] = label.ContactInfo ?? "";
            cmdInsertLabel["profile"]     = label.Profile ?? "";
            cmdInsertLabel["parentlabel"] = label.ParentLabel ?? "";
            long labelId = cmdInsertLabel.Execute();

            if (label.Images != null)
            {
                InsertLabelImages(label, labelId);
            }
            if (label.Urls != null)
            {
                InsertLabelUrls(label, labelId);
            }
        }
Esempio n. 3
0
        public void InsertFts(Release release)
        {
            cmdReleaseFts["id"] = release.Id;
            StringBuilder fts = new StringBuilder();

            fts.Append(release.Aggregate.JoinedArtistsFixed);
            fts.Append(" ");
            fts.Append(release.Title);
            foreach (ReleaseLabel label in release.Labels)
            {
                fts.Append(" ");
                fts.Append(label.Name);
                fts.Append(" ");
                fts.Append(label.CatalogNumber);
            }
            cmdReleaseFts["fts"] = fts.ToString();
            cmdReleaseFts.Execute();
        }
Esempio n. 4
0
        public long Find(string name)
        {
            if (styleCache.ContainsKey(name))
            {
                return(styleCache[name]);
            }

            cmdSelectStyle.Parameters["style"].Value = name;
            using (var reader = cmdSelectStyle.ExecuteReader())
            {
                if (reader.Read())
                {
                    return(styleCache[name] = reader.GetInt64("id"));
                }
            }

            cmdInsertStyle["style"] = name;
            return(styleCache[name] = cmdInsertStyle.Execute());
        }
Esempio n. 5
0
        public void Insert(Artist artist)
        {
            try
            {
                cmdArtist["name"]     = artist.Name;
                cmdArtist["realname"] = artist.RealName ?? "";
                cmdArtist["profile"]  = artist.Profile ?? "";
                long artistId = cmdArtist.Execute();

                if (artist.Aliases != null)
                {
                    InsertAliases(artist, artistId);
                }
                if (artist.Groups != null)
                {
                    InsertGroups(artist, artistId);
                }
                if (artist.Images != null)
                {
                    InsertImages(artist, artistId);
                }
                if (artist.Members != null)
                {
                    InsertMembers(artist, artistId);
                }
                if (artist.NameVariations != null)
                {
                    InsertNameVariations(artist, artistId);
                }
                if (artist.Urls != null)
                {
                    InsertUrls(artist, artistId);
                }
            }
            catch (Exception ex)
            {
                Console.WriteLine("Error inserting artist: " + ex.Message);
            }
        }