本文整理汇总了C#中JMMServer.Repositories.VideoLocalRepository.GetByID方法的典型用法代码示例。如果您正苦于以下问题:C# VideoLocalRepository.GetByID方法的具体用法?C# VideoLocalRepository.GetByID怎么用?C# VideoLocalRepository.GetByID使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类JMMServer.Repositories.VideoLocalRepository
的用法示例。
在下文中一共展示了VideoLocalRepository.GetByID方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: ProcessCommand
public override void ProcessCommand()
{
try
{
VideoLocalRepository repVids = new VideoLocalRepository();
VideoLocal vlocal = repVids.GetByID(VideoLocalID);
if (vlocal == null) return;
XMLService.Send_FileHash(vlocal);
}
catch (Exception ex)
{
logger.Error("Error processing CommandRequest_WebCacheSendFileHash: {0} - {1}", VideoLocalID, ex.ToString());
return;
}
}
示例2: ProcessCommand
public override void ProcessCommand()
{
logger.Info("Processing File: {0}", VideoLocalID);
try
{
VideoLocalRepository repVids = new VideoLocalRepository();
vlocal = repVids.GetByID(VideoLocalID);
if (vlocal == null) return;
//now that we have all the has info, we can get the AniDB Info
ProcessFile_AniDB(vlocal);
}
catch (Exception ex)
{
logger.Error("Error processing CommandRequest_ProcessFile: {0} - {1}", VideoLocalID, ex.ToString());
return;
}
// TODO update stats for group and series
// TODO check for TvDB
}
示例3: SetVariationStatusOnFile
public string SetVariationStatusOnFile(int videoLocalID, bool isVariation)
{
try
{
VideoLocalRepository repVids = new VideoLocalRepository();
VideoLocal vid = repVids.GetByID(videoLocalID);
if (vid == null)
return "Could not find video record";
vid.IsVariation = isVariation ? 1 : 0;
repVids.Save(vid);
return "";
}
catch (Exception ex)
{
logger.ErrorException(ex.ToString(), ex);
return ex.Message;
}
}
示例4: DeleteFFDPreset
public void DeleteFFDPreset(int videoLocalID)
{
try
{
VideoLocalRepository repVids = new VideoLocalRepository();
FileFfdshowPresetRepository repFFD = new FileFfdshowPresetRepository();
VideoLocal vid = repVids.GetByID(videoLocalID);
if (vid == null) return;
FileFfdshowPreset ffd = repFFD.GetByHashAndSize(vid.Hash, vid.FileSize);
if (ffd == null) return;
repFFD.Delete(ffd.FileFfdshowPresetID);
}
catch (Exception ex)
{
logger.ErrorException(ex.ToString(), ex);
}
}
示例5: RenameFilePreview
public Contract_VideoLocalRenamed RenameFilePreview(int videoLocalID, string renameRules)
{
Contract_VideoLocalRenamed ret = new Contract_VideoLocalRenamed();
ret.VideoLocalID = videoLocalID;
ret.Success = true;
try
{
VideoLocalRepository repVids = new VideoLocalRepository();
VideoLocal vid = repVids.GetByID(videoLocalID);
if (vid == null)
{
ret.VideoLocal = null;
ret.NewFileName = string.Format("ERROR: Could not find file record");
ret.Success = false;
}
else
{
if (videoLocalID == 726)
Debug.Write("test");
ret.VideoLocal = null;
ret.NewFileName = RenameFileHelper.GetNewFileName(vid, renameRules);
if (string.IsNullOrEmpty(ret.NewFileName)) ret.Success = false;
}
}
catch (Exception ex)
{
logger.ErrorException(ex.ToString(), ex);
ret.VideoLocal = null;
ret.NewFileName = string.Format("ERROR: {0}", ex.Message);
ret.Success = false;
}
return ret;
}
示例6: RenameFile
public Contract_VideoLocalRenamed RenameFile(int videoLocalID, string renameRules)
{
Contract_VideoLocalRenamed ret = new Contract_VideoLocalRenamed();
ret.VideoLocalID = videoLocalID;
ret.Success = true;
try
{
VideoLocalRepository repVids = new VideoLocalRepository();
VideoLocal vid = repVids.GetByID(videoLocalID);
if (vid == null)
{
ret.VideoLocal = null;
ret.NewFileName = string.Format("ERROR: Could not find file record");
ret.Success = false;
}
else
{
ret.VideoLocal = null;
ret.NewFileName = RenameFileHelper.GetNewFileName(vid, renameRules);
if (!string.IsNullOrEmpty(ret.NewFileName))
{
// check if the file exists
string fullFileName = vid.FullServerPath;
if (!File.Exists(fullFileName))
{
ret.NewFileName = "Error could not find the original file";
ret.Success = false;
return ret;
}
// actually rename the file
string path = Path.GetDirectoryName(fullFileName);
string newFullName = Path.Combine(path, ret.NewFileName);
try
{
logger.Info(string.Format("Renaming file From ({0}) to ({1})....", fullFileName, newFullName));
if (fullFileName.Equals(newFullName, StringComparison.InvariantCultureIgnoreCase))
{
logger.Info(string.Format("Renaming file SKIPPED, no change From ({0}) to ({1})", fullFileName, newFullName));
ret.NewFileName = newFullName;
}
else
{
File.Move(fullFileName, newFullName);
logger.Info(string.Format("Renaming file SUCCESS From ({0}) to ({1})", fullFileName, newFullName));
ret.NewFileName = newFullName;
string newPartialPath = "";
int folderID = vid.ImportFolderID;
ImportFolderRepository repFolders = new ImportFolderRepository();
DataAccessHelper.GetShareAndPath(newFullName, repFolders.GetAll(), ref folderID, ref newPartialPath);
vid.FilePath = newPartialPath;
repVids.Save(vid);
}
}
catch (Exception ex)
{
logger.Info(string.Format("Renaming file FAIL From ({0}) to ({1}) - {2}", fullFileName, newFullName, ex.Message));
logger.ErrorException(ex.ToString(), ex);
ret.Success = false;
ret.NewFileName = ex.Message;
}
}
}
}
catch (Exception ex)
{
logger.ErrorException(ex.ToString(), ex);
ret.VideoLocal = null;
ret.NewFileName = string.Format("ERROR: {0}", ex.Message);
ret.Success = false;
}
return ret;
}
示例7: InternalGetFile
private System.IO.Stream InternalGetFile(int userid, string Id)
{
int id;
if (!int.TryParse(Id, out id))
return new MemoryStream();
KodiObject ret =new KodiObject(KodiHelper.NewMediaContainer("Unsort", true));
if (!ret.Init())
return new MemoryStream();
List<Video> dirs= new List<Video>();
Video v = new Video();
dirs.Add(v);
VideoLocalRepository repVids = new VideoLocalRepository();
VideoLocal vi = repVids.GetByID(id);
if (vi == null)
return new MemoryStream();
KodiHelper.PopulateVideo(v,vi,JMMType.File,userid);
ret.Childrens = dirs;
ret.MediaContainer.Art = v.Art;
return ret.GetStream();
}
示例8: DeleteVideoLocalAndFile
/// <summary>
/// Delets the VideoLocal record and the associated physical file
/// </summary>
/// <param name="videoLocalID"></param>
/// <returns></returns>
public string DeleteVideoLocalAndFile(int videoLocalID)
{
try
{
VideoLocalRepository repVids = new VideoLocalRepository();
VideoLocal vid = repVids.GetByID(videoLocalID);
if (vid == null) return "Database entry does not exist";
logger.Info("Deleting video local record and file: {0}", vid.FullServerPath);
if (File.Exists(vid.FullServerPath))
{
try
{
File.Delete(vid.FullServerPath);
}
catch { }
}
AnimeSeries ser = null;
List<AnimeEpisode> animeEpisodes = vid.GetAnimeEpisodes();
if (animeEpisodes.Count > 0)
ser = animeEpisodes[0].GetAnimeSeries();
CommandRequest_DeleteFileFromMyList cmdDel = new CommandRequest_DeleteFileFromMyList(vid.Hash, vid.FileSize);
cmdDel.Save();
repVids.Delete(videoLocalID);
if (ser != null)
{
ser.QueueUpdateStats();
//StatsCache.Instance.UpdateUsingSeries(ser.AnimeSeriesID);
}
// For deletion of files from Trakt, we will rely on the Daily sync
return "";
}
catch (Exception ex)
{
logger.ErrorException(ex.ToString(), ex);
return ex.Message;
}
}
示例9: GetFFDPreset
public Contract_FileFfdshowPreset GetFFDPreset(int videoLocalID)
{
VideoLocalRepository repVids = new VideoLocalRepository();
FileFfdshowPresetRepository repFFD = new FileFfdshowPresetRepository();
try
{
VideoLocal vid = repVids.GetByID(videoLocalID);
if (vid == null) return null;
FileFfdshowPreset ffd = repFFD.GetByHashAndSize(vid.Hash, vid.FileSize);
if (ffd == null) return null;
return ffd.ToContract();
}
catch (Exception ex)
{
logger.ErrorException(ex.ToString(), ex);
}
return null;
}
示例10: GetEpisodesForFile
public List<Contract_AnimeEpisode> GetEpisodesForFile(int videoLocalID, int userID)
{
List<Contract_AnimeEpisode> contracts = new List<Contract_AnimeEpisode>();
try
{
VideoLocalRepository repVids = new VideoLocalRepository();
VideoLocal vid = repVids.GetByID(videoLocalID);
if (vid == null)
return contracts;
foreach (AnimeEpisode ep in vid.GetAnimeEpisodes())
{
contracts.Add(ep.ToContract(userID));
}
return contracts;
}
catch (Exception ex)
{
logger.ErrorException(ex.ToString(), ex);
return contracts;
}
}
示例11: AssociateSingleFileWithMultipleEpisodes
public string AssociateSingleFileWithMultipleEpisodes(int videoLocalID, int animeSeriesID, int startEpNum, int endEpNum)
{
try
{
VideoLocalRepository repVids = new VideoLocalRepository();
VideoLocal vid = repVids.GetByID(videoLocalID);
if (vid == null)
return "Could not find video record";
AnimeEpisodeRepository repEps = new AnimeEpisodeRepository();
AnimeSeriesRepository repSeries = new AnimeSeriesRepository();
AniDB_EpisodeRepository repAniEps = new AniDB_EpisodeRepository();
CrossRef_File_EpisodeRepository repXRefs = new CrossRef_File_EpisodeRepository();
AnimeSeries ser = repSeries.GetByID(animeSeriesID);
if (ser == null)
return "Could not find anime series record";
for (int i = startEpNum; i <= endEpNum; i++)
{
List<AniDB_Episode> anieps = repAniEps.GetByAnimeIDAndEpisodeNumber(ser.AniDB_ID, i);
if (anieps.Count == 0)
return "Could not find the AniDB episode record";
AniDB_Episode aniep = anieps[0];
List<AnimeEpisode> eps = repEps.GetByAniEpisodeIDAndSeriesID(aniep.EpisodeID, ser.AnimeSeriesID);
if (eps.Count == 0)
return "Could not find episode record";
AnimeEpisode ep = eps[0];
CrossRef_File_Episode xref = new CrossRef_File_Episode();
xref.PopulateManually(vid, ep);
repXRefs.Save(xref);
CommandRequest_WebCacheSendXRefFileEpisode cr = new CommandRequest_WebCacheSendXRefFileEpisode(xref.CrossRef_File_EpisodeID);
cr.Save();
}
vid.RenameIfRequired();
vid.MoveFileIfRequired();
ser.QueueUpdateStats();
// update epidsode added 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);
}
return "";
}
catch (Exception ex)
{
logger.ErrorException(ex.ToString(), ex);
}
return "";
}
示例12: AssociateSingleFile
public string AssociateSingleFile(int videoLocalID, int animeEpisodeID)
{
try
{
VideoLocalRepository repVids = new VideoLocalRepository();
VideoLocal vid = repVids.GetByID(videoLocalID);
if (vid == null)
return "Could not find video record";
AnimeEpisodeRepository repEps = new AnimeEpisodeRepository();
AnimeEpisode ep = repEps.GetByID(animeEpisodeID);
if (ep == null)
return "Could not find episode record";
CrossRef_File_EpisodeRepository repXRefs = new CrossRef_File_EpisodeRepository();
CrossRef_File_Episode xref = new CrossRef_File_Episode();
try
{
xref.PopulateManually(vid, ep);
}
catch (Exception ex)
{
string msg = string.Format("Error populating XREF: {0}", vid.ToStringDetailed());
throw;
}
repXRefs.Save(xref);
vid.RenameIfRequired();
vid.MoveFileIfRequired();
CommandRequest_WebCacheSendXRefFileEpisode cr = new CommandRequest_WebCacheSendXRefFileEpisode(xref.CrossRef_File_EpisodeID);
cr.Save();
AnimeSeries ser = ep.GetAnimeSeries();
ser.QueueUpdateStats();
// update epidsode added stats
AnimeSeriesRepository repSeries = new AnimeSeriesRepository();
ser.EpisodeAddedDate = DateTime.Now;
repSeries.Save(ser);
AnimeGroupRepository repGroups = new AnimeGroupRepository();
foreach (AnimeGroup grp in ser.AllGroupsAbove)
{
grp.EpisodeAddedDate = DateTime.Now;
repGroups.Save(grp);
}
CommandRequest_AddFileToMyList cmdAddFile = new CommandRequest_AddFileToMyList(vid.Hash);
cmdAddFile.Save();
return "";
}
catch (Exception ex)
{
logger.ErrorException(ex.ToString(), ex);
}
return "";
}
示例13: AssociateMultipleFiles
public string AssociateMultipleFiles(List<int> videoLocalIDs, int animeSeriesID, int startingEpisodeNumber, bool singleEpisode)
{
try
{
CrossRef_File_EpisodeRepository repXRefs = new CrossRef_File_EpisodeRepository();
AnimeSeriesRepository repSeries = new AnimeSeriesRepository();
VideoLocalRepository repVids = new VideoLocalRepository();
AniDB_EpisodeRepository repAniEps = new AniDB_EpisodeRepository();
AnimeEpisodeRepository repEps = new AnimeEpisodeRepository();
AnimeSeries ser = repSeries.GetByID(animeSeriesID);
if (ser == null)
return "Could not find anime series record";
int epNumber = startingEpisodeNumber;
int count = 1;
foreach (int videoLocalID in videoLocalIDs)
{
VideoLocal vid = repVids.GetByID(videoLocalID);
if (vid == null)
return "Could not find video local record";
List<AniDB_Episode> anieps = repAniEps.GetByAnimeIDAndEpisodeNumber(ser.AniDB_ID, epNumber);
if (anieps.Count == 0)
return "Could not find the AniDB episode record";
AniDB_Episode aniep = anieps[0];
List<AnimeEpisode> eps = repEps.GetByAniEpisodeIDAndSeriesID(aniep.EpisodeID, ser.AnimeSeriesID);
if (eps.Count == 0)
return "Could not find episode record";
AnimeEpisode ep = eps[0];
CrossRef_File_Episode xref = new CrossRef_File_Episode();
xref.PopulateManually(vid, ep);
// TODO do this properly
if (singleEpisode)
{
xref.EpisodeOrder = count;
if (videoLocalIDs.Count > 5)
xref.Percentage = 100;
else
xref.Percentage = GetEpisodePercentages(videoLocalIDs.Count)[count - 1];
}
repXRefs.Save(xref);
vid.RenameIfRequired();
vid.MoveFileIfRequired();
CommandRequest_WebCacheSendXRefFileEpisode cr = new CommandRequest_WebCacheSendXRefFileEpisode(xref.CrossRef_File_EpisodeID);
cr.Save();
count++;
if (!singleEpisode) epNumber++;
}
ser.QueueUpdateStats();
// update epidsode added 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);
}
}
catch (Exception ex)
{
logger.ErrorException(ex.ToString(), ex);
}
return "";
}
示例14: ProcessCommand
public override void ProcessCommand()
{
logger.Info("Get AniDB file info: {0}", VideoLocalID);
try
{
AniDB_FileRepository repAniFile = new AniDB_FileRepository();
VideoLocalRepository repVids = new VideoLocalRepository();
vlocal = repVids.GetByID(VideoLocalID);
if (vlocal == null) return;
AniDB_File aniFile = repAniFile.GetByHashAndFileSize(vlocal.Hash, vlocal.FileSize);
/*// get anidb file info from web cache
if (aniFile == null && ServerSettings.WebCache_AniDB_File_Get)
{
AniDB_FileRequest fr = XMLService.Get_AniDB_File(vlocal.Hash, vlocal.FileSize);
if (fr != null)
{
aniFile = new AniDB_File();
aniFile.Populate(fr);
//overwrite with local file name
string localFileName = Path.GetFileName(vlocal.FilePath);
aniFile.FileName = localFileName;
repAniFile.Save(aniFile, false);
aniFile.CreateLanguages();
aniFile.CreateCrossEpisodes(localFileName);
StatsCache.Instance.UpdateUsingAniDBFile(vlocal.Hash);
}
}*/
Raw_AniDB_File fileInfo = null;
if (aniFile == null || ForceAniDB)
fileInfo = JMMService.AnidbProcessor.GetFileInfo(vlocal);
if (fileInfo != null)
{
// save to the database
if (aniFile == null)
aniFile = new AniDB_File();
aniFile.Populate(fileInfo);
//overwrite with local file name
string localFileName = Path.GetFileName(vlocal.FilePath);
aniFile.FileName = localFileName;
repAniFile.Save(aniFile, false);
aniFile.CreateLanguages();
aniFile.CreateCrossEpisodes(localFileName);
if (!string.IsNullOrEmpty(fileInfo.OtherEpisodesRAW))
{
string[] epIDs = fileInfo.OtherEpisodesRAW.Split(',');
foreach (string epid in epIDs)
{
int id = 0;
if (int.TryParse(epid, out id))
{
CommandRequest_GetEpisode cmdEp = new CommandRequest_GetEpisode(id);
cmdEp.Save();
}
}
}
StatsCache.Instance.UpdateUsingAniDBFile(vlocal.Hash);
}
}
catch (Exception ex)
{
logger.Error("Error processing CommandRequest_GetFile: {0} - {1}", VideoLocalID, ex.ToString());
return;
}
}
示例15: ToggleWatchedStatusOnVideo
public string ToggleWatchedStatusOnVideo(int videoLocalID, bool watchedStatus, int userID)
{
try
{
VideoLocalRepository repVids = new VideoLocalRepository();
VideoLocal vid = repVids.GetByID(videoLocalID);
if (vid == null)
return "Could not find video local record";
vid.ToggleWatchedStatus(watchedStatus, true, DateTime.Now, true, true, userID, true, true);
return "";
}
catch (Exception ex)
{
logger.ErrorException(ex.ToString(), ex);
return ex.Message;
}
}