Exemplo n.º 1
0
 void GenerateThumbs()
 {
     CreateThread("RinDB.GenerateThumbs", () =>
     {
         ThumbGenerator.QueueThumb(RinDB.GetAll());
     });
 }
Exemplo n.º 2
0
        void RegisterTags()
        {
            //Default Tags
            "Tohsaka Rin".ToBase60();
            RinDB.CreateTag(new TagModel("Tohsaka Rin", "character", "Rin Tohsaka from the Fate series by TYPE-MOON"));
            RinDB.CreateTag(new TagModel("Hatsune Miku", "character", "Vocaloid Hatsune Miku"));
            RinDB.CreateTag(new TagModel("Zettai Ryouiki", "tag", "Absolute Territory"));
            RinDB.CreateTag(new TagModel("Spice and Wolf", "work", "Spice and wolf Anime/Manga/Lite Novel"));
            RinDB.CreateTag(new TagModel("Holo", "character", "The wise wolf of Yoitsu"));
            RinDB.CreateTag(new TagModel("Twin Tails", "tag", "Hair in twin tails"));
            RinDB.CreateTag(new TagModel("Tsundere", "tag", "Character is a tsundere, or shows tsundere traits"));
            RinDB.CreateTag(new TagModel("Rem", "character", "Rem from Re:Zero"));
            RinDB.CreateTag(new TagModel("Ram", "character", "Ram from Re:Zero"));
            RinDB.CreateTag(new TagModel("Emilia ", "character", "I love Emilia"));
            RinDB.CreateTag(new TagModel("Misaka Mikoto", "character", "Misaka Mikoto from A Certain Madigcal Index/A Certain Scientific Railgun"));
            RinDB.CreateTag(new TagModel("A Certain Scientific Railgun", "work", "A Certain Scientific Railgun from the Raildex series"));
            RinDB.CreateTag(new TagModel("A Certain Magical Index", "work", "A Certain Magical Index from the Raildex series"));
            TagModel fate = RinDB.CreateTag(new TagModel("Fate", "work", "The Fate series by TYPE-MOON"));

            RinDB.CreateTag(new TagModel("Fate/Zero", "work", "Fate/Zero from the Fate series by TYPE-MOON")
            {
                parentID = fate.id
            });
            RinDB.CreateTag(new TagModel("Fate/Stay Night", "work", "Fate/Stay Night from the Fate series by TYPE-MOON")
            {
                parentID = fate.id
            });
            RinDB.CreateTag(new TagModel("Fate/Stay Night: UBW", "work", "Fate/Stay Night: UBW from the Fate series by TYPE-MOON")
            {
                parentID = fate.id
            });
            RinDB.CreateTag(new TagModel("ReLife", "work", "The ReLife Anime/Manga"));
            RinDB.CreateTag(new TagModel("Megane", "tag", "Character wears glasses"));
            RinDB.CreateTag(new TagModel("Kemonomimi", "tag", "Character has animal ears and/or tail"));
            RinDB.CreateTag(new TagModel("Re:Zero", "work", "Re:Zero Anime/Manga"));
            TagModel irl      = RinDB.CreateTag(new TagModel("IRL", "meta", "Image is of a real person"));
            TagModel tentacle = RinDB.CreateTag(new TagModel("Tentacles", "tag", "You know where this is going"));

            RinDB.CreateTag(new TagModel("Contentacles", "tag", "Consentual tentacles")
            {
                parentID = tentacle.id
            });
            RinDB.CreateTag(new TagModel("Cosplay", "tag", "A person is cosplaying a character")
            {
                parentID = irl.id
            });
            RinDB.CreateTag(new TagModel("Plastic Memories", "work", "Plastic Memories Anime"));
            RinDB.CreateTag(new TagModel("Grisaia", "work", "The Grisaia series of VNs and Anime"));
            RinDB.CreateTag(new TagModel("Ore Gairu SNAFU", "work", "Yahari Ore no Seishun Love Comedy wa Machigatteiru Anime/Manga."));
            RinDB.CreateTag(new TagModel("Megumin", "character", "Explosion!!!"));
            RinDB.CreateTag(new TagModel("KonoSuba", "work", "kono subarashii sekai ni shukufuku wo Anime/Manga"));
            RinDB.CreateTag(new TagModel("Pettanko", "tag", "Small/Flat breasted character but do not have a child-like appearance i.e: Holo"));
            RinDB.CreateTag(new TagModel("Loli", "tag", "Character who has a childish appearance, i.e Shinobu"));
            RinDB.CreateTag(new TagModel("No Pantsu", "tag", "A character is not wearing pantsu"));
            RinDB.CreateTag(new TagModel("Sukumizu", "tag", "A variant of swimwear intended for use during swim lessons, predominately in Japan. They are traditionally a one piece and don't have any openings."));
        }
Exemplo n.º 3
0
 void Rebuild()
 {
     CreateThread("RinDB.rebuild", () =>
     {
         Write("Rebuild Start");
         DateTime start = DateTime.Now;
         using (NpgsqlConnection con = RinDB.GetConnection())
         {
             con.Open();
             using (NpgsqlCommand cmd = con.CreateCommand())
             {
                 cmd.CommandText = "DELETE FROM images; DELETE FROM tagmap; DELETE FROM tags; SELECT setval('images_index_seq', 1);";
                 cmd.ExecuteNonQuery();
                 //string[] files = Directory.GetFiles(RinDB.THUMB_DIR);
                 //foreach (string f in files)
                 //	File.Delete(f);
                 //RinDB.AddTagToAll(tag.id);
                 //return;
                 RegisterTags();
                 Dictionary <string, string[]> buildList = new Dictionary <string, string[]>();
                 buildList.Add("OneTrueTohsaka", new string[] { "Tohsaka Rin", "Fate" });
                 buildList.Add("awwnime", null);
                 buildList.Add("Animewallpaper", null);
                 buildList.Add("Animelegs", null);
                 buildList.Add("OneTrueRem", new string[] { "Rem", "Re:Zero" });
                 buildList.Add("ZettaiRyouiki", new string[] { "Zettai Ryouiki" });
                 buildList.Add("ZettaiRyouikiIRL", new string[] { "Zettai Ryouiki", "IRL" });
                 buildList.Add("consentacles", new string[] { "Tentacles", "Consentacles" });
                 buildList.Add("grisaia", new string[] { "Grisaia" });
                 buildList.Add("hatsune", new string[] { "Hatsune Miku" });
                 buildList.Add("hentiny", null);
                 buildList.Add("imouto", null);
                 buildList.Add("kemonomimi", new string[] { "Kemonomimi" });
                 buildList.Add("megane", new string[] { "Megane" });
                 buildList.Add("nopan", new string[] { "No Pantsu" });
                 buildList.Add("OneTrueBiribiri", new string[] { "Misaka Mikoto", "A Certain Scientific Railgun" });
                 buildList.Add("OneTrueRam", new string[] { "Ram", "Re:Zero" });
                 buildList.Add("OreGairuSNAFU", new string[] { "Ore Gairu SNAFU" });
                 buildList.Add("plamemo", new string[] { "Plastic Memories" });
                 buildList.Add("ReLIFE", new string[] { "ReLife" });
                 buildList.Add("SpiceandWolf", new string[] { "Spice and Wolf" });
                 buildList.Add("Tentai", new string[] { "Tentacles" });
                 buildList.Add("twintails", new string[] { "Twin Tails" });
                 buildList.Add("Megumin", new string[] { "Megumin", "KonoSuba" });
                 buildList.Add("SukumizuIRL", new string[] { "Sukumizu", "IRL" });
                 DoBuild(buildList);
             }
         }
         Write($"Rebuild Complete in {(DateTime.Now - start).Seconds}s");
     });
     //GenerateThumbs();
 }
Exemplo n.º 4
0
 void AddTag()
 {
     if (string.IsNullOrWhiteSpace(_buildTag))
     {
         throw new CommandInterpreterExeception("No Tag provided");
     }
     if (!(_tagType == "tag" || _tagType == "character" || _tagType == "artist" || _tagType == "work" || _tagType == "meta"))
     {
         throw new CommandInterpreterExeception("Invalid tag type provided");
     }
     RinDB.CreateTag(new TagModel(_buildTag, _tagType, _tagInfo));
     _buildTag = _tagInfo = null;
     _tagType  = "tag";
 }
Exemplo n.º 5
0
 void Default()
 {
     RinDB.Init(_dbUser, _dbPass, _dbName);
     Thread t = CreateThread("RinDB", () =>
     {
         host = new NancyHost(new HostConfiguration()
         {
             UrlReservations = new UrlReservations()
             {
                 CreateAutomatically = true
             }
         }, new Uri("http://localhost:1234"));
         host.Start();
     });
 }
Exemplo n.º 6
0
 //Download an image via url
 void SaveImage(Post p, string file, Uri url)
 {
     try
     {
         data = _client.DownloadData(url);
         string ext = Path.GetExtension(url.AbsolutePath);
         using (FileStream image = new FileStream($"{file}{ext}", FileMode.Create, FileAccess.Write))
         {
             try
             {
                 if (!Directory.GetParent(file).Exists)
                 {
                     Directory.GetParent(file).Create();
                 }
                 image.Write(data, 0, data.Length);
                 LOGGER.Log($"Saved {file}{ext}", $"/r/{p.SubredditName}", verbose);
                 image.Flush();
                 RinDB.AddImage(new ImageModel()
                 {
                     name      = Uri.EscapeDataString(Path.GetFileNameWithoutExtension(file).Remove(0, p.CreatedUTC.ToEpoch().ToString().Length + 2)),
                     fileUri   = Uri.EscapeDataString($"{file.Replace($"{baseDir}/", "")}{ext}"),
                     timeadded = p.CreatedUTC.ToEpoch(),
                     isnsfw    = p.NSFW,
                     tags      = _curTags?.ToList()
                 });
                 imgCount++;
             }catch (Exception e)
             {
                 LOGGER.LogError($"Failed to save \"{p.Title}\", {e.Message}", $"/r/{p.SubredditName}", verbose);
                 LOGGER.LogError(e.StackTrace, name, verbose);
             }
         }
     }
     catch (Exception e)
     {
         LOGGER.LogWarning($"Unable to Download {p.Title}, {e.Message}", $"/r/{p.SubredditName}", verbose);
         LOGGER.LogError(e.StackTrace, name, verbose);
     }
 }