本文整理汇总了C#中VideoInfo.GetOtherAsString方法的典型用法代码示例。如果您正苦于以下问题:C# VideoInfo.GetOtherAsString方法的具体用法?C# VideoInfo.GetOtherAsString怎么用?C# VideoInfo.GetOtherAsString使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类VideoInfo
的用法示例。
在下文中一共展示了VideoInfo.GetOtherAsString方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: AddFavoriteVideo
public bool AddFavoriteVideo(VideoInfo video, string titleFromUtil, string siteName)
{
siteName = RemoveInvalidChars(siteName);
string title = string.IsNullOrEmpty(titleFromUtil) ? "" : RemoveInvalidChars(titleFromUtil);
string desc = string.IsNullOrEmpty(video.Description) ? "" : RemoveInvalidChars(video.Description);
string thumb = string.IsNullOrEmpty(video.Thumb) ? "" : RemoveInvalidChars(video.Thumb);
string url = string.IsNullOrEmpty(video.VideoUrl) ? "" : RemoveInvalidChars(video.VideoUrl);
string length = string.IsNullOrEmpty(video.Length) ? "" : RemoveInvalidChars(video.Length);
string airdate = string.IsNullOrEmpty(video.Airdate) ? "" : RemoveInvalidChars(video.Airdate);
string other = RemoveInvalidChars(video.GetOtherAsString());
Log.Info("inserting favorite on site '{4}' with title: '{0}', desc: '{1}', thumb: '{2}', url: '{3}'", title, desc, thumb, url, siteName);
using (var cnn = OpenConnection())
{
using (var cmd = cnn.CreateCommand())
{
//check if the video is already in the favorite list
string sql = string.Format("select VDO_ID from FAVORITE_VIDEOS where VDO_SITE_ID='{0}' AND VDO_URL='{1}' and VDO_OTHER_NFO='{2}'", siteName, url, other);
cmd.CommandText = sql;
using (var reader = cmd.ExecuteReader())
{
if (reader.HasRows)
{
Log.Info("Favorite Video '{0}' already in database", title);
return false;
}
}
sql = string.Format("insert into FAVORITE_VIDEOS(VDO_NM,VDO_URL,VDO_DESC,VDO_TAGS,VDO_LENGTH,VDO_OTHER_NFO,VDO_IMG_URL,VDO_SITE_ID)VALUES('{0}','{1}','{2}','{3}','{4}','{5}','{6}','{7}')",
title, url, desc, airdate, length, other, thumb, siteName);
cmd.CommandText = sql;
if (cmd.ExecuteNonQuery() > 0)
{
Log.Info("Favorite '{0}' inserted successfully into database", video.Title);
return true;
}
else
{
Log.Warn("Favorite '{0}' failed to insert into database", video.Title);
return false;
}
}
}
}
示例2: GetVideoUrl
public override string GetVideoUrl(VideoInfo video)
{
string data;
if (video.Other is string && !string.IsNullOrWhiteSpace(video.GetOtherAsString()))
data = video.GetOtherAsString();
else
data = GetWebData(video.VideoUrl);
Regex r = new Regex(@"<tr class=""linkTr"">.*?""linkQuality[^>]*>(?<q>[^<]*)<.*?linkHiddenUrl[^>]*>(?<u>[^<]*)<.*?</tr", RegexOptions.Singleline);
Dictionary<string, string> d = new Dictionary<string, string>();
List<Hoster.HosterBase> hosters = Hoster.HosterFactory.GetAllHosters();
foreach (Match m in r.Matches(data))
{
string u = m.Groups["u"].Value;
Hoster.HosterBase hoster = hosters.FirstOrDefault(h => u.ToLowerInvariant().Contains(h.GetHosterUrl().ToLowerInvariant()));
if (hoster != null)
{
string format = hoster.GetHosterUrl() + " [" + m.Groups["q"].Value + "] " + "({0})";
int count = 1;
while (d.ContainsKey(string.Format(format, count)))
{
count++;
}
d.Add(string.Format(format, count), u);
}
}
d = d.OrderBy((p) =>
{
return p.Key;
}).ToDictionary(kvp => kvp.Key, kvp => kvp.Value);
video.PlaybackOptions = d;
if (d.Count == 0)
return "";
if ((video as LosMoviesVideoInfo).TrackingInfo == null)
{
(video as LosMoviesVideoInfo).TrackingInfo = new TrackingInfo()
{
VideoKind = VideoKind.Movie,
Title = video.Title,
Year = GetRelesaseYear(data),
ID_IMDB = GetImdbId(data)
};
}
//sh.SetSubtitleText(video, GetTrackingInfo, false);
string latestOption = (video is LosMoviesVideoInfo) ? (video as LosMoviesVideoInfo).LatestOption : "";
if (string.IsNullOrEmpty(latestOption))
return d.First().Value;
if (d.ContainsKey(latestOption))
return d[latestOption];
return d.First().Value;
}