Ejemplo n.º 1
0
 public List <SVR_CrossRef_AniDB_Provider> GetByProvider(CrossRefType type, string providerid)
 {
     using (RepoLock.ReaderLock())
     {
         if (IsCached)
         {
             return(CrossRefs.GetMultiple(type, providerid));
         }
         return(Table.Where(a => a.CrossRefType == type && a.CrossRefID == providerid).ToList());
     }
 }
Ejemplo n.º 2
0
 public List <IgnoreAnime> GetByUser(int userID)
 {
     using (RepoLock.ReaderLock())
     {
         if (IsCached)
         {
             return(Users.GetMultiple(userID));
         }
         return(Table.Where(a => a.JMMUserID == userID).ToList());
     }
 }
 public AnimeStaff GetByAniDBID(int id)
 {
     using (RepoLock.ReaderLock())
     {
         if (IsCached)
         {
             return(AniDBIDs.GetOne(id));
         }
         return(Table.FirstOrDefault(s => s.AniDBID == id));
     }
 }
Ejemplo n.º 4
0
 public IgnoreAnime GetByAnimeUserType(int animeID, int userID, int ignoreType)
 {
     using (RepoLock.ReaderLock())
     {
         if (IsCached)
         {
             return(AnimeUserIgnores.GetOne(animeID, userID, ignoreType));
         }
         return(Table.FirstOrDefault(a => a.AnimeID == animeID && a.JMMUserID == userID && a.IgnoreType == ignoreType));
     }
 }
Ejemplo n.º 5
0
 public List <IgnoreAnime> GetByUserAndType(int userID, int ignoreType)
 {
     using (RepoLock.ReaderLock())
     {
         if (IsCached)
         {
             return(UserIgnores.GetMultiple(userID, ignoreType));
         }
         return(Table.Where(a => a.JMMUserID == userID && a.IgnoreType == ignoreType).ToList());
     }
 }
Ejemplo n.º 6
0
 public List <SVR_VideoLocal_Place> GetByFilePathAndImportFolderType(string filePath, int folderType)
 {
     using (RepoLock.ReaderLock())
     {
         if (IsCached)
         {
             return(Paths.GetMultiple(filePath).FindAll(a => a.ImportFolderType == folderType));
         }
         return(Table.Where(a => a.FilePath == filePath && a.ImportFolderType == folderType).ToList());
     }
 }
Ejemplo n.º 7
0
 public List <SVR_VideoLocal_Place> GetByVideoLocal(int videolocalid)
 {
     using (RepoLock.ReaderLock())
     {
         if (IsCached)
         {
             return(VideoLocals.GetMultiple(videolocalid));
         }
         return(Table.Where(a => a.VideoLocalID == videolocalid).ToList());
     }
 }
Ejemplo n.º 8
0
 public List <SVR_VideoLocal_Place> GetByImportFolder(int importFolderID)
 {
     using (RepoLock.ReaderLock())
     {
         if (IsCached)
         {
             return(ImportFolders.GetMultiple(importFolderID));
         }
         return(Table.Where(a => a.ImportFolderID == importFolderID).ToList());
     }
 }
Ejemplo n.º 9
0
 public SVR_VideoLocal_Place GetByFilePathAndShareID(string filePath, int nshareID)
 {
     using (RepoLock.ReaderLock())
     {
         if (IsCached)
         {
             return(Paths.GetMultiple(filePath).FirstOrDefault(a => a.ImportFolderID == nshareID));
         }
         return(Table.FirstOrDefault(a => a.FilePath == filePath && a.ImportFolderID == nshareID));
     }
 }
Ejemplo n.º 10
0
 public TvDB_Series GetByTvDBID(int id)
 {
     using (RepoLock.ReaderLock())
     {
         if (IsCached)
         {
             return(TvDBIDs.GetOne(id));
         }
         return(Table.FirstOrDefault(a => a.SeriesID == id));
     }
 }
Ejemplo n.º 11
0
 public Dictionary <int, TvDB_Series> GetByTvDBIDs(IEnumerable <int> ids)
 {
     using (RepoLock.ReaderLock())
     {
         if (IsCached)
         {
             return(ids.ToDictionary(a => a, a => TvDBIDs.GetOne(a)));
         }
         return(Table.Where(a => ids.Contains(a.SeriesID)).ToDictionary(a => a.SeriesID, a => a));
     }
 }
Ejemplo n.º 12
0
 public Dictionary <int, (int type, string title, DateTime?airdate)> GetRelationInfo()
 {
     using (RepoLock.ReaderLock())
     {
         if (IsCached)
         {
             return(Cache.Values.ToDictionary(a => a.AnimeID, a => (a.AnimeType, a.MainTitle, a.AirDate)));
         }
         return(Table.ToDictionary(a => a.AnimeID, a => (a.AnimeType, a.MainTitle, a.AirDate)));
     }
 }
Ejemplo n.º 13
0
 public List <SVR_CrossRef_AniDB_Provider> GetByAnimeIDAndType(int animeID, CrossRefType xrefType)
 {
     using (RepoLock.ReaderLock())
     {
         if (IsCached)
         {
             return(Animes.GetMultiple(animeID).Where(a => a.CrossRefType == xrefType).ToList());
         }
         return(Table.Where(a => a.AnimeID == animeID && a.CrossRefType == xrefType).ToList());
     }
 }
Ejemplo n.º 14
0
 public SVR_CrossRef_AniDB_Provider GetByAnimeIdAndProvider(CrossRefType type, int animeid, string providerid)
 {
     using (RepoLock.ReaderLock())
     {
         if (IsCached)
         {
             return(CrossRefs.GetMultiple(type, providerid).FirstOrDefault(a => a.AnimeID == animeid));
         }
         return(Table.FirstOrDefault(a => a.CrossRefType == type && a.CrossRefID == providerid && a.AnimeID == animeid));
     }
 }
Ejemplo n.º 15
0
 public List <CrossRef_Anime_Staff> GetByAnimeID(int id)
 {
     using (RepoLock.ReaderLock())
     {
         if (IsCached)
         {
             return(AnimeIDs.GetMultiple(id));
         }
         return(Table.Where(s => s.AniDB_AnimeID == id).ToList());
     }
 }
Ejemplo n.º 16
0
 public List <CrossRef_Anime_Staff> GetByRoleType(StaffRoleType type)
 {
     using (RepoLock.ReaderLock())
     {
         if (IsCached)
         {
             return(RoleTypes.GetMultiple(type));
         }
         return(Table.Where(s => (StaffRoleType)s.RoleType == type).ToList());
     }
 }
Ejemplo n.º 17
0
 public List <SVR_CrossRef_AniDB_Provider> GetByType(CrossRefType xrefType)
 {
     using (RepoLock.ReaderLock())
     {
         if (IsCached)
         {
             return(CrossTypes.GetMultiple(xrefType));
         }
         return(Table.Where(a => a.CrossRefType == xrefType).ToList());
     }
 }
Ejemplo n.º 18
0
 public int GetQueuedCommandCount(params string[] wt)
 {
     using (RepoLock.ReaderLock())
     {
         if (IsCached)
         {
             return(wt.Sum(b => WorkTypes.GetMultiple(b).Count(a => a.ExecutionDate <= DateTime.UtcNow)));
         }
         List <string> ls = wt.ToList();
         return(Table.Count(a => ls.Contains(a.Type) && a.ExecutionDate <= DateTime.UtcNow));
     }
 }
 public List <AniDB_Episode_Title> GetByEpisodeIDAndLanguage(int id, string language)
 {
     using (RepoLock.ReaderLock())
     {
         if (IsCached)
         {
             return(Episodes.GetMultiple(id).Where(a =>
                                                   a.Language.Equals(language, StringComparison.InvariantCultureIgnoreCase)).ToList());
         }
         return(Table.Where(s => s.AniDB_EpisodeID == id && s.Language.Equals(language, StringComparison.InvariantCultureIgnoreCase)).ToList());
     }
 }
 public List <CrossRef_AniDB_TraktV2> GetByAnimeIDEpTypeEpNumber(int id, int aniEpType,
                                                                 int aniEpisodeNumber)
 {
     using (RepoLock.ReaderLock())
     {
         if (IsCached)
         {
             return(Animes.GetMultiple(id).Where(a => a.AniDBStartEpisodeType == aniEpType && a.AniDBStartEpisodeNumber == aniEpisodeNumber).ToList());
         }
         return(Table.Where(a => a.AnimeID == id && a.AniDBStartEpisodeType == aniEpType && a.AniDBStartEpisodeNumber == aniEpisodeNumber).ToList());
     }
 }
        public void DeleteAllWithUserID(int userID)
        {
            List <AuthTokens> tokens;

            using (RepoLock.ReaderLock())
            {
                tokens = IsCached
                    ? UserIDs.GetMultiple(userID).ToList()
                    : Table.Where(a => a.UserID == userID).ToList();
            }
            Delete(tokens);
        }
Ejemplo n.º 22
0
 public List <CrossRef_AniDB_TvDB_Episode> GetByAniDBEpisodeID(int id)
 {
     // TODO Change this when multiple AniDB <=> TvDB Episode mappings
     using (RepoLock.ReaderLock())
     {
         if (IsCached)
         {
             return(EpisodeIDs.GetMultiple(id).ToList());
         }
         return(Table.Where(a => a.AniDBEpisodeID == id).ToList());
     }
 }
Ejemplo n.º 23
0
 public void CleanUpAllgroupsIds()
 {
     using (RepoLock.ReaderLock())
     {
         List <SVR_GroupFilter> series = IsCached ? Cache.Values.ToList() : Table.ToList();
         ShokoContext           ctx    = Provider.GetContext();
         ctx.AttachRange(series);
         series.ForEach(a => a.GroupsIdsString = null);
         ctx.SaveChanges();
         ctx.DetachRange(series);
     }
 }
Ejemplo n.º 24
0
 public List <DuplicateFile> GetByFilePathAndImportFolder(string filePath, int folderID)
 {
     using (RepoLock.ReaderLock())
     {
         if (IsCached)
         {
             return(FileImport1.GetMultiple(filePath, folderID).Union(FileImport2.GetMultiple(filePath, folderID)).ToList());
         }
         return(Table.Where(a =>
                            (a.FilePathFile1 == filePath && a.ImportFolderIDFile1 == folderID) ||
                            (a.FilePathFile2 == filePath && a.ImportFolderIDFile2 == folderID)).ToList());
     }
 }
Ejemplo n.º 25
0
        public List <AniDB_Episode> GetEpisodesWithMultipleFiles()
        {
            List <int> ids = Repo.Instance.CrossRef_File_Episode.GetEpisodesIdsWithMultipleFiles();

            using (RepoLock.ReaderLock())
            {
                if (IsCached)
                {
                    return(ids.Select(a => EpisodesIds.GetOne(a)).ToList());
                }
                return(Table.Where(a => ids.Contains(a.EpisodeID)).ToList());
            }
        }
Ejemplo n.º 26
0
 public List <CrossRef_AniDB_TvDBV2> GetByTvDBID(int id)
 {
     using (RepoLock.ReaderLock())
     {
         if (IsCached)
         {
             return(TvDBIDs.GetMultiple(id).OrderBy(xref => xref.AniDBStartEpisodeType)
                    .ThenBy(xref => xref.AniDBStartEpisodeNumber).ToList());
         }
         return(Table.Where(a => a.TvDBID == id).OrderBy(xref => xref.AniDBStartEpisodeType)
                .ThenBy(xref => xref.AniDBStartEpisodeNumber).ToList());
     }
 }
        /// <summary>
        /// Return a list of Anime IDs in a prequel/sequel line, including the given animeID, in order
        /// </summary>
        /// <param name="animeID"></param>
        /// <returns></returns>
        public List <int> GetFullLinearRelationTree(int animeID)
        {
            using (RepoLock.ReaderLock())
            {
                var           allRelations = GetLinearRelations(animeID);
                HashSet <int> visitedNodes = new HashSet <int> {
                    animeID
                };
                HashSet <int> resultRelations = new HashSet <int>(allRelations);
                GetAllRelationsByTypeRecursive(allRelations, ref visitedNodes, ref resultRelations);

                return(resultRelations.OrderBy(a => a).ToList());
            }
        }
Ejemplo n.º 28
0
        public List <CrossRef_AniDB_TvDB_Episode> GetByAnimeID(int id)
        {
            using (RepoLock.ReaderLock())
            {
                if (IsCached)
                {
                    return(AnimeIDs.GetMultiple(id));
                }

                return(Table
                       .Join(Repo.Instance.AniDB_Episode.GetAll(), a => a.AniDBEpisodeID, b => b.AniDB_EpisodeID, (xref, ae) => new { xref, ae })
                       .Where(jn => jn.ae.AnimeID == id).Select(jn => jn.xref).ToList());
            }
        }
Ejemplo n.º 29
0
        public List <CrossRef_AniDB_TvDB_Episode_Override> GetByAnimeID(int id)
        {
            using (RepoLock.ReaderLock())
            {
                if (IsCached)
                {
                    return(AnimeIDs.GetMultiple(id));
                }

                return(Table
                       .Join(Repo.Instance.AniDB_Episode.GetAll(), s => s.AniDBEpisodeID, s => s.AniDB_EpisodeID, (xref, aniEp) => new { xref, aniEp })
                       .Where(s => s.aniEp.AnimeID == id).Select(s => s.xref).ToList());
            }
        }
Ejemplo n.º 30
0
 public CrossRef_AniDB_TvDB_Episode_Override GetByAniDBAndTvDBEpisodeIDs(int anidbID, int tvdbID)
 {
     using (RepoLock.ReaderLock())
     {
         if (IsCached)
         {
             return(EpisodeIDs.GetMultiple(anidbID).FirstOrDefault(a => a.TvDBEpisodeID == tvdbID));
         }
         else
         {
             return(Table.Where(s => s.AniDBEpisodeID == anidbID).FirstOrDefault(a => a.TvDBEpisodeID == tvdbID));
         }
     }
 }