public ActionResult ByPVBase(PVService service, string pvId, string callback, DataFormat format = DataFormat.Auto) { var song = Service.GetSongWithPV(s => new EntryBaseContract(s), service, pvId); return(Object(song, format, callback)); }
public static string VideoServiceLinkUrl(this HtmlHelper htmlHelper, PVService service) { switch (service) { case PVService.Bilibili: return(UrlHelper.GenerateContentUrl("~/Content/ExtIcons/bilibili.png", new HttpContextWrapper(HttpContext.Current))); case PVService.File: return(UrlHelper.GenerateContentUrl("~/Content/Icons/music.png", new HttpContextWrapper(HttpContext.Current))); case PVService.NicoNicoDouga: return(UrlHelper.GenerateContentUrl("~/Content/nico.png", new HttpContextWrapper(HttpContext.Current))); case PVService.Piapro: return(UrlHelper.GenerateContentUrl("~/Content/ExtIcons/piapro.png", new HttpContextWrapper(HttpContext.Current))); case PVService.SoundCloud: return(UrlHelper.GenerateContentUrl("~/Content/Icons/soundcloud.png", new HttpContextWrapper(HttpContext.Current))); case PVService.Youtube: return(UrlHelper.GenerateContentUrl("~/Content/youtube.png", new HttpContextWrapper(HttpContext.Current))); case PVService.Vimeo: return(UrlHelper.GenerateContentUrl("~/Content/ExtIcons/vimeo.png", new HttpContextWrapper(HttpContext.Current))); default: return(string.Empty); } }
public ActionResult ByPV(PVService service, string pvId, ContentLanguagePreference?lang, string callback, DataFormat format = DataFormat.Auto) { var song = Service.GetSongWithPV(s => new SongForApiContract(s, lang ?? ContentLanguagePreference.Default), service, pvId); return(Object(song, format, callback)); }
public ActionResult ByPVBase(PVService service, string pvId, string callback, DataFormat format = DataFormat.Auto) { var song = Service.GetSongWithPV(s => new EntryBaseContract(s), service, pvId); return Object(song, format, callback); }
public ActionResult ByPV(PVService service, string pvId, ContentLanguagePreference? lang, string callback, DataFormat format = DataFormat.Auto) { var song = Service.GetSongWithPV(s => new SongForApiContract(s, lang ?? ContentLanguagePreference.Default), service, pvId); return Object(song, format, callback); }
public static T GetPV <T>(T[] allPvs, PVService service) where T : class, IPV { var servicePvs = allPvs.Where(p => p.Service == service).ToArray(); return(servicePvs.FirstOrDefault(p => p.PVType == PVType.Original) ?? servicePvs.FirstOrDefault(p => p.PVType == PVType.Reprint) ?? servicePvs.FirstOrDefault()); }
public static T GetPV <T>(T[] allPvs, PVService service) where T : class, IPV { var servicePvs = allPvs.Where(p => p.Service == service).ToArray(); return(GetPV(servicePvs, true, p => p.PVType == PVType.Original, p => p.PVType == PVType.Reprint)); }
public PVContract PVForSongAndService(int songId, PVService service) { return(HandleQuery(ctx => { var pvs = ctx.OfType <PVForSong>().Query().Where(pv => pv.Song.Id == songId && pv.Service == service).ToArray(); var primaryPv = VideoServiceHelper.PrimaryPV(pvs, service); return primaryPv != null ? new PVContract(primaryPv) : null; })); }
public SongForApiContract GetByPV( PVService pvService, string pvId, SongOptionalFields fields = SongOptionalFields.None, ContentLanguagePreference lang = ContentLanguagePreference.Default) { var song = service.GetSongWithPV(s => new SongForApiContract(s, null, lang, fields), pvService, pvId); return(song); }
public T GetSongWithPV <T>(Func <Song, T> fac, PVService service, string pvId) where T : class { return(HandleQuery(session => { var pv = session.Query <PVForSong>() .FirstOrDefault(p => p.Service == service && p.PVId == pvId && !p.Song.Deleted); return (pv != null ? fac(pv.Song) : null); })); }
public ActionResult ByPVBase(PVService? service, string pvId, string callback, DataFormat format = DataFormat.Auto) { if (service == null) return HttpStatusCodeResult(HttpStatusCode.BadRequest, "Service not specified or invalid"); var song = Service.GetSongWithPV(s => new EntryBaseContract(s), service.Value, pvId); return Object(song, format, callback); }
private VideoUrlParseResult(string url, PVService service, string id, VideoTitleParseResult meta) { Url = url; Service = service; Id = id; Title = meta.Title ?? string.Empty; Author = meta.Author ?? string.Empty; ThumbUrl = meta.ThumbUrl ?? string.Empty; ResultType = VideoUrlParseResultType.Ok; }
public static VideoUrlParseResult VideoUrlParseResultWithTitle( string url = "http://nicovideo.jp/watch/sm1234567", PVService service = PVService.NicoNicoDouga, string id = "sm1234567", string title = "Resistance", string author = "tripshots", string thumbUrl = "", int?length = null, string[] tags = null) { return(VideoUrlParseResult.CreateOk(url, service, id, VideoTitleParseResult.CreateSuccess(title, author, thumbUrl, length, tags))); }
public static VideoUrlParseResult VideoUrlParseResultWithTitle( string url = "http://nicovideo.jp/watch/sm1234567", PVService service = PVService.NicoNicoDouga, string id = "sm1234567", string title = "Resistance", string author = "tripshots", string thumbUrl = "", int? length = null, string[] tags = null) { return VideoUrlParseResult.CreateOk(url, service, id, VideoTitleParseResult.CreateSuccess(title, author, thumbUrl, length, tags)); }
public ActionResult ByPV(PVService? service, string pvId, ContentLanguagePreference? lang, string callback, bool includeAlbums = true, bool includeArtists = true, bool includeNames = true, bool includePVs = false, bool includeTags = true, bool includeWebLinks = false, DataFormat format = DataFormat.Auto) { if (service == null) return HttpStatusCodeResult(HttpStatusCode.BadRequest, "Service not specified or invalid"); var song = Service.GetSongWithPV(s => new SongForApiContract(s, null, lang ?? ContentLanguagePreference.Default, includeAlbums, includeArtists, includeNames, includePVs, includeTags, true, includeWebLinks), service.Value, pvId); return Object(song, format, callback); }
public ActionResult PVRedirect(PVService service, string pvId) { var song = Service.GetSongWithPV(service, pvId); if (song == null) { TempData.SetWarnMessage("Sorry, song not found! Maybe it hasn't been added yet."); return(RedirectToAction("Index", "Home")); } else { return(RedirectToAction("Details", new { id = song.Id })); } }
private VideoUrlParseResult(string url, PVService service, string id, VideoTitleParseResult meta) { Url = url; Service = service; Id = id; Title = meta.Title ?? string.Empty; Author = meta.Author ?? string.Empty; AuthorId = meta.AuthorId ?? string.Empty; ThumbUrl = meta.ThumbUrl ?? string.Empty; LengthSeconds = meta.LengthSeconds; Tags = meta.Tags; UploadDate = meta.UploadDate; ResultType = VideoUrlParseResultType.Ok; }
public static string VideoServiceLinkUrl(this IHtmlHelper htmlHelper, PVService service) { // Code from: https://stackoverflow.com/questions/38865163/how-to-get-the-urlhelper-from-html-helper-context-in-asp-net-core-mvc-html-helpe/51519624#51519624 var urlHelperFactory = htmlHelper.ViewContext.HttpContext.RequestServices.GetRequiredService <IUrlHelperFactory>(); var urlHelper = urlHelperFactory.GetUrlHelper(htmlHelper.ViewContext); return(service switch { PVService.Bandcamp => urlHelper.Content("~/Content/ExtIcons/bandcamp.png"), PVService.Bilibili => urlHelper.Content("~/Content/ExtIcons/bilibili.png"), PVService.File or PVService.LocalFile => urlHelper.Content("~/Content/Icons/music.png"), PVService.NicoNicoDouga => urlHelper.Content("~/Content/nico.png"), PVService.Piapro => urlHelper.Content("~/Content/ExtIcons/piapro.png"), PVService.SoundCloud => urlHelper.Content("~/Content/Icons/soundcloud.png"), PVService.Youtube => urlHelper.Content("~/Content/youtube.png"), PVService.Vimeo => urlHelper.Content("~/Content/ExtIcons/vimeo.png"), PVService.Creofuga => urlHelper.Content("~/Content/ExtIcons/creofuga.png"), _ => string.Empty, });
public int DeletePVsByAuthor(string author, PVService service) { PermissionContext.VerifyPermission(PermissionToken.BulkDeletePVs); if (string.IsNullOrEmpty(author)) { return(0); } return(HandleTransaction(session => { AuditLog(string.Format("deleting PVs by '{0}' for service {1}.", author, service), session); var pvs = session.Query <PVForSong>().Where(p => p.Service == service && p.Author == author).ToArray(); foreach (var pv in pvs) { pv.OnDelete(); session.Delete(pv); } return pvs.Length; })); }
public VideoServicePiapro(PVService service, IVideoServiceParser parser, RegexLinkMatcher[] linkMatchers) : base(service, parser, linkMatchers) {}
public static bool ShowExternalSiteLink(PVService service) { return(!servicesWithoutExternalSiteLink.Contains(service)); }
public static string GetUrl(PVService service, string pvId) { return(VideoServiceHelper.Services[service].GetUrlById(pvId)); }
public ActionResult PVRedirect(PVService service, string pvId) { var song = Service.GetSongWithPV(service, pvId); if (song == null) { TempData.SetWarnMessage("Sorry, song not found! Maybe it hasn't been added yet."); return RedirectToAction("Index", "Home"); } else { return RedirectToAction("Details", new { id = song.Id }); } }
public string GetPVId(int id, PVService service) { var pv = queries.PVForSongAndService(id, service); return(pv.PVId); }
private PVForSong CreatePV(PVService service = PVService.Youtube, PVType pvType = PVType.Original, DateTime?publishDate = null) { return(song.CreatePV(new PVContract { Service = service, PVId = "test", Name = "test", PublishDate = publishDate, PVType = pvType })); }
public SongWithAlbumContract GetSongWithPVAndAlbum(PVService service, string pvId) { return(GetSongWithPV(s => new SongWithAlbumContract(s, PermissionContext.LanguagePreference), service, pvId)); }
public static string GetUrl(PVService service, string pvId, PVExtendedMetadata extendedMetadata = null) { return(VideoServiceHelper.Services[service].GetUrlById(pvId, extendedMetadata)); }
protected VideoService(PVService service, IVideoServiceParser parser, RegexLinkMatcher[] linkMatchers) { Service = service; this.parser = parser; this.linkMatchers = linkMatchers; }
public SongForApiContract GetByPV( PVService pvService, string pvId, SongOptionalFields fields = SongOptionalFields.None, ContentLanguagePreference lang = ContentLanguagePreference.Default) { var song = service.GetSongWithPV(s => new SongForApiContract(s, null, lang, fields), pvService, pvId); return song; }
private void CreatePV(PVService service) { song.CreatePV(new PVContract { Service = service, PVId = "test", Name = "test" }); }
public VideoServiceSoundCloud(PVService service, IVideoServiceParser parser, RegexLinkMatcher[] linkMatchers) : base(service, parser, linkMatchers) {}
public VideoServicePiapro(PVService service, IVideoServiceParser parser, RegexLinkMatcher[] linkMatchers) : base(service, parser, linkMatchers) { }
public PVServiceIconViewModel(PVService service) { Service = service; }
public SongWithAlbumContract GetSongWithPV(PVService service, string pvId) { return Services.Songs.GetSongWithPVAndAlbum(service, pvId); }
public SongWithAdditionalNamesContract GetSongWithPV(PVService service, string pvId) { return(Services.Songs.GetSongWithPV(service, pvId)); }
public bool IsValidFor(PVService service) { return (service == Service); }
/// <summary> /// Returns PV player HTML by song Id and PV service. Primary PV of that type will be selected. /// </summary> public ActionResult PVForSongAndService(int songId = invalidId, PVService? service = null) { if (songId == invalidId) return NoId(); if (service == null) return NoId(); var pv = queries.PVForSongAndService(songId, service.Value); return PartialView("PVs/_PVEmbedDynamic", pv); }
public VideoServiceSoundCloud(PVService service, IVideoServiceParser parser, RegexLinkMatcher[] linkMatchers) : base(service, parser, linkMatchers) { }
public ImportedSongInListContract(PVService service, string pvId) { PVService = service; PVId = pvId; }
public virtual bool HasPV(PVService service, string pvId) { ParamIs.NotNullOrEmpty(() => pvId); return(PVs.Any(p => p.Service == service && p.PVId == pvId)); }
public static VideoUrlParseResult CreateOk(string url, PVService service, string id, VideoTitleParseResult meta) { return new VideoUrlParseResult(url, service, id, meta); }
public SongWithAlbumContract GetSongWithPV(PVService service, string pvId) { return(songService.GetSongWithPVAndAlbum(service, pvId)); }
public SongWithAdditionalNamesContract GetSongWithPV(PVService service, string pvId) { return Services.Songs.GetSongWithPV(service, pvId); }
public static VideoUrlParseResult CreateOk(string url, PVService service, string id, VideoTitleParseResult meta) { return(new VideoUrlParseResult(url, service, id, meta)); }
public string GetPVId(int songId, PVService service) { var pv = queries.PVForSongAndService(songId, service); return pv.PVId; }