本文整理汇总了C#中JMMServer.Repositories.VideoLocalRepository.GetVideosWithoutEpisode方法的典型用法代码示例。如果您正苦于以下问题:C# VideoLocalRepository.GetVideosWithoutEpisode方法的具体用法?C# VideoLocalRepository.GetVideosWithoutEpisode怎么用?C# VideoLocalRepository.GetVideosWithoutEpisode使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类JMMServer.Repositories.VideoLocalRepository
的用法示例。
在下文中一共展示了VideoLocalRepository.GetVideosWithoutEpisode方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: RescanUnlinkedFiles
public void RescanUnlinkedFiles()
{
try
{
// files which have been hashed, but don't have an associated episode
VideoLocalRepository repVidLocals = new VideoLocalRepository();
List<VideoLocal> filesWithoutEpisode = repVidLocals.GetVideosWithoutEpisode();
foreach (VideoLocal vl in filesWithoutEpisode)
{
CommandRequest_ProcessFile cmd = new CommandRequest_ProcessFile(vl.VideoLocalID, true);
cmd.Save();
}
}
catch (Exception ex)
{
logger.ErrorException(ex.Message, ex);
}
}
示例2: workerMyAnime2_DoWork
void workerMyAnime2_DoWork(object sender, DoWorkEventArgs e)
{
MA2Progress ma2Progress = new MA2Progress();
ma2Progress.CurrentFile = 0;
ma2Progress.ErrorMessage = "";
ma2Progress.MigratedFiles = 0;
ma2Progress.TotalFiles = 0;
try
{
string databasePath = e.Argument as string;
string connString = string.Format(@"data source={0};useutf16encoding=True", databasePath);
SQLiteConnection myConn = new SQLiteConnection(connString);
myConn.Open();
// get a list of unlinked files
VideoLocalRepository repVids = new VideoLocalRepository();
AniDB_EpisodeRepository repAniEps = new AniDB_EpisodeRepository();
AniDB_AnimeRepository repAniAnime = new AniDB_AnimeRepository();
AnimeSeriesRepository repSeries = new AnimeSeriesRepository();
AnimeEpisodeRepository repEps = new AnimeEpisodeRepository();
List<VideoLocal> vids = repVids.GetVideosWithoutEpisode();
ma2Progress.TotalFiles = vids.Count;
foreach (VideoLocal vid in vids)
{
ma2Progress.CurrentFile = ma2Progress.CurrentFile + 1;
workerMyAnime2.ReportProgress(0, ma2Progress);
// search for this file in the XrossRef table in MA2
string sql = string.Format("SELECT AniDB_EpisodeID from CrossRef_Episode_FileHash WHERE Hash = '{0}' AND FileSize = {1}", vid.ED2KHash, vid.FileSize);
SQLiteCommand sqCommand = new SQLiteCommand(sql);
sqCommand.Connection = myConn;
SQLiteDataReader myReader = sqCommand.ExecuteReader();
while (myReader.Read())
{
int episodeID = 0;
if (!int.TryParse(myReader.GetValue(0).ToString(), out episodeID)) continue;
if (episodeID <= 0) continue;
sql = string.Format("SELECT AnimeID from AniDB_Episode WHERE EpisodeID = {0}", episodeID);
sqCommand = new SQLiteCommand(sql);
sqCommand.Connection = myConn;
SQLiteDataReader myReader2 = sqCommand.ExecuteReader();
while (myReader2.Read())
{
int animeID = myReader2.GetInt32(0);
// so now we have all the needed details we can link the file to the episode
// as long as wehave the details in JMM
AniDB_Anime anime = null;
AniDB_Episode ep = repAniEps.GetByEpisodeID(episodeID);
if (ep == null)
{
logger.Debug("Getting Anime record from AniDB....");
anime = JMMService.AnidbProcessor.GetAnimeInfoHTTP(animeID, true, ServerSettings.AutoGroupSeries);
}
else
anime = repAniAnime.GetByAnimeID(animeID);
// create the group/series/episode records if needed
AnimeSeries ser = null;
if (anime == null) continue;
logger.Debug("Creating groups, series and episodes....");
// check if there is an AnimeSeries Record associated with this AnimeID
ser = repSeries.GetByAnimeID(animeID);
if (ser == null)
{
// create a new AnimeSeries record
ser = anime.CreateAnimeSeriesAndGroup();
}
ser.CreateAnimeEpisodes();
// check if we have any group status data for this associated anime
// if not we will download it now
AniDB_GroupStatusRepository repStatus = new AniDB_GroupStatusRepository();
if (repStatus.GetByAnimeID(anime.AnimeID).Count == 0)
{
CommandRequest_GetReleaseGroupStatus cmdStatus = new CommandRequest_GetReleaseGroupStatus(anime.AnimeID, false);
cmdStatus.Save();
}
// update stats
ser.EpisodeAddedDate = DateTime.Now;
repSeries.Save(ser);
AnimeGroupRepository repGroups = new AnimeGroupRepository();
foreach (AnimeGroup grp in ser.AllGroupsAbove)
{
grp.EpisodeAddedDate = DateTime.Now;
repGroups.Save(grp);
}
//.........这里部分代码省略.........
示例3: RunImport_IntegrityCheck
public static void RunImport_IntegrityCheck()
{
VideoLocalRepository repVidLocals = new VideoLocalRepository();
AniDB_FileRepository repAniFile = new AniDB_FileRepository();
AniDB_EpisodeRepository repAniEps = new AniDB_EpisodeRepository();
AniDB_AnimeRepository repAniAnime = new AniDB_AnimeRepository();
// files which don't have a valid import folder
List<VideoLocal> filesToDelete = repVidLocals.GetVideosWithoutImportFolder();
foreach (VideoLocal vl in filesToDelete)
repVidLocals.Delete(vl.VideoLocalID);
// files which have not been hashed yet
// or files which do not have a VideoInfo record
List<VideoLocal> filesToHash = repVidLocals.GetVideosWithoutHash();
Dictionary<int, VideoLocal> dictFilesToHash = new Dictionary<int, VideoLocal>();
foreach (VideoLocal vl in filesToHash)
{
dictFilesToHash[vl.VideoLocalID] = vl;
CommandRequest_HashFile cmd = new CommandRequest_HashFile(vl.FullServerPath, false);
cmd.Save();
}
List<VideoLocal> filesToRehash = repVidLocals.GetVideosWithoutVideoInfo();
Dictionary<int, VideoLocal> dictFilesToRehash = new Dictionary<int, VideoLocal>();
foreach (VideoLocal vl in filesToHash)
{
dictFilesToRehash[vl.VideoLocalID] = vl;
// don't use if it is in the previous list
if (!dictFilesToHash.ContainsKey(vl.VideoLocalID))
{
try
{
CommandRequest_HashFile cmd = new CommandRequest_HashFile(vl.FullServerPath, false);
cmd.Save();
}
catch (Exception ex)
{
string msg = string.Format("Error RunImport_IntegrityCheck XREF: {0} - {1}", vl.ToStringDetailed(), ex.ToString());
logger.Info(msg);
}
}
}
// files which have been hashed, but don't have an associated episode
List<VideoLocal> filesWithoutEpisode = repVidLocals.GetVideosWithoutEpisode();
Dictionary<int, VideoLocal> dictFilesWithoutEpisode = new Dictionary<int, VideoLocal>();
foreach (VideoLocal vl in filesWithoutEpisode)
dictFilesWithoutEpisode[vl.VideoLocalID] = vl;
// check that all the episode data is populated
List<VideoLocal> filesAll = repVidLocals.GetAll();
Dictionary<string, VideoLocal> dictFilesAllExisting = new Dictionary<string, VideoLocal>();
foreach (VideoLocal vl in filesAll)
{
try
{
dictFilesAllExisting[vl.FullServerPath] = vl;
}
catch (Exception ex)
{
string msg = string.Format("Error RunImport_IntegrityCheck XREF: {0} - {1}", vl.ToStringDetailed(), ex.ToString());
logger.Error(msg);
continue;
}
// check if it has an episode
if (dictFilesWithoutEpisode.ContainsKey(vl.VideoLocalID))
{
CommandRequest_ProcessFile cmd = new CommandRequest_ProcessFile(vl.VideoLocalID, false);
cmd.Save();
continue;
}
// if the file is not manually associated, then check for AniDB_File info
AniDB_File aniFile = repAniFile.GetByHash(vl.Hash);
foreach (CrossRef_File_Episode xref in vl.EpisodeCrossRefs)
{
if (xref.CrossRefSource != (int)CrossRefSource.AniDB) continue;
if (aniFile == null)
{
CommandRequest_ProcessFile cmd = new CommandRequest_ProcessFile(vl.VideoLocalID, false);
cmd.Save();
continue;
}
}
if (aniFile == null) continue;
// the cross ref is created before the actually episode data is downloaded
// so lets check for that
bool missingEpisodes = false;
foreach (CrossRef_File_Episode xref in aniFile.EpisodeCrossRefs)
{
AniDB_Episode ep = repAniEps.GetByEpisodeID(xref.EpisodeID);
if (ep == null) missingEpisodes = true;
//.........这里部分代码省略.........
示例4: GetUnrecognisedFiles
public List<Contract_VideoLocal> GetUnrecognisedFiles(int userID)
{
List<Contract_VideoLocal> contracts = new List<Contract_VideoLocal>();
try
{
VideoLocalRepository repVids = new VideoLocalRepository();
foreach (VideoLocal vid in repVids.GetVideosWithoutEpisode())
{
contracts.Add(vid.ToContract(userID));
}
}
catch (Exception ex)
{
logger.ErrorException(ex.ToString(), ex);
}
return contracts;
}
示例5: CheckForAniDBFileUpdate
public static void CheckForAniDBFileUpdate(bool forceRefresh)
{
if (ServerSettings.AniDB_File_UpdateFrequency == ScheduledUpdateFrequency.Never && !forceRefresh) return;
int freqHours = Utils.GetScheduledHours(ServerSettings.AniDB_File_UpdateFrequency);
// check for any updated anime info every 12 hours
ScheduledUpdateRepository repSched = new ScheduledUpdateRepository();
AniDB_AnimeRepository repAnime = new AniDB_AnimeRepository();
ScheduledUpdate sched = repSched.GetByUpdateType((int)ScheduledUpdateType.AniDBFileUpdates);
if (sched != null)
{
// if we have run this in the last 12 hours and are not forcing it, then exit
TimeSpan tsLastRun = DateTime.Now - sched.LastUpdate;
if (tsLastRun.TotalHours < freqHours)
{
if (!forceRefresh) return;
}
}
UpdateAniDBFileData(true, false, false);
// files which have been hashed, but don't have an associated episode
VideoLocalRepository repVidLocals = new VideoLocalRepository();
List<VideoLocal> filesWithoutEpisode = repVidLocals.GetVideosWithoutEpisode();
foreach (VideoLocal vl in filesWithoutEpisode)
{
CommandRequest_ProcessFile cmd = new CommandRequest_ProcessFile(vl.VideoLocalID, true);
cmd.Save();
}
// now check for any files which have been manually linked and are less than 30 days old
if (sched == null)
{
sched = new ScheduledUpdate();
sched.UpdateType = (int)ScheduledUpdateType.AniDBFileUpdates;
sched.UpdateDetails = "";
}
sched.LastUpdate = DateTime.Now;
repSched.Save(sched);
}
示例6: GetUnsort
private System.IO.Stream GetUnsort(int userid)
{
KodiObject ret =new KodiObject(KodiHelper.NewMediaContainer("Unsort", true));
if (!ret.Init())
return new MemoryStream();
List<Video> dirs= new List<Video>();
ret.MediaContainer.ViewMode = "65586";
ret.MediaContainer.ViewGroup = "video";
VideoLocalRepository repVids = new VideoLocalRepository();
List<VideoLocal> vids = repVids.GetVideosWithoutEpisode();
foreach (VideoLocal v in vids.OrderByDescending(a => a.DateTimeCreated))
{
Video m = new Video();
try
{
KodiHelper.PopulateVideo(m, v, JMMType.File, userid);
if (!string.IsNullOrEmpty(m.Duration))
{
dirs.Add(m);
}
}
catch (Exception e)
{
//Fast fix if file do not exist, and still is in db. (Xml Serialization of video info will fail on null)
}
}
ret.Childrens = dirs;
return ret.GetStream();
}
示例7: GetFilters
public System.IO.Stream GetFilters(string uid)
{
JMMUser user = KodiHelper.GetUser(uid);
if (user==null)
return new MemoryStream();
int userid = user.JMMUserID;
KodiObject ret =new KodiObject(KodiHelper.NewMediaContainer("Anime", false));
if (!ret.Init())
return new MemoryStream();
List<Video> dirs = new List<Video>();
try
{
using (var session = JMMService.SessionFactory.OpenSession())
{
GroupFilterRepository repGF = new GroupFilterRepository();
List<GroupFilter> allGfs = repGF.GetAll(session);
Dictionary<int, HashSet<int>> gstats = StatsCache.Instance.StatUserGroupFilter[userid];
foreach (GroupFilter gg in allGfs.ToArray())
{
if ((!StatsCache.Instance.StatUserGroupFilter.ContainsKey(userid)) ||
(!StatsCache.Instance.StatUserGroupFilter[userid].ContainsKey(gg.GroupFilterID)))
{
allGfs.Remove(gg);
}
}
AnimeGroupRepository repGroups = new AnimeGroupRepository();
allGfs.Insert(0, new GroupFilter() {GroupFilterName = "All", GroupFilterID = -999});
foreach (GroupFilter gg in allGfs)
{
Random rnd = new Random(123456789);
Directory pp = new Directory();
pp.Key = KodiHelper.ServerUrl(int.Parse(ServerSettings.JMMServerPort),
MainWindow.PathAddressKodi + "/GetMetadata/" + userid + "/" +
(int) JMMType.GroupFilter + "/" + gg.GroupFilterID);
pp.PrimaryExtraKey = pp.Key;
pp.Title = gg.GroupFilterName;
HashSet<int> groups;
groups = gg.GroupFilterID == -999 ? new HashSet<int>(repGroups.GetAllTopLevelGroups(session).Select(a => a.AnimeGroupID)) : gstats[gg.GroupFilterID];
if (groups.Count != 0)
{
bool repeat;
int nn = 0;
pp.LeafCount = groups.Count.ToString();
pp.ViewedLeafCount = "0";
do
{
repeat = true;
int grp = groups.ElementAt(rnd.Next(groups.Count));
AnimeGroup ag = repGroups.GetByID(grp);
List<AnimeSeries> sers = ag.GetSeries(session);
if (sers.Count > 0)
{
AnimeSeries ser = sers[rnd.Next(sers.Count)];
AniDB_Anime anim = ser.GetAnime(session);
if (anim != null)
{
ImageDetails poster = anim.GetDefaultPosterDetailsNoBlanks(session);
ImageDetails fanart = anim.GetDefaultFanartDetailsNoBlanks(session);
if (poster != null)
pp.Thumb = poster.GenPoster();
if (fanart != null)
pp.Art = fanart.GenArt();
if (poster != null)
repeat = false;
}
}
nn++;
if ((repeat) && (nn == 15))
repeat = false;
} while (repeat);
dirs.Add(pp);
}
}
VideoLocalRepository repVids = new VideoLocalRepository();
List<VideoLocal> vids = repVids.GetVideosWithoutEpisode();
if (vids.Count > 0)
{
JMMContracts.KodiContracts.Directory pp = new JMMContracts.KodiContracts.Directory();
pp.Key = pp.PrimaryExtraKey = KodiHelper.ServerUrl(int.Parse(ServerSettings.JMMServerPort),
MainWindow.PathAddressKodi + "/GetMetadata/0/" + (int) JMMType.GroupUnsort + "/0");
pp.Title = "Unsort";
pp.Thumb = KodiHelper.ServerUrl(int.Parse(ServerSettings.JMMServerPort),
MainWindow.PathAddressKodi + "/GetSupportImage/plex_unsort.png");
pp.LeafCount = vids.Count.ToString();
pp.ViewedLeafCount = "0";
dirs.Add(pp);
}
dirs = dirs.OrderBy(a => a.Title).ToList();
}
ret.Childrens = dirs;
return ret.GetStream();
}
catch (Exception ex)
{
//.........这里部分代码省略.........