本文整理汇总了C#中MediaPortal.Playlists.PlayListItem类的典型用法代码示例。如果您正苦于以下问题:C# PlayListItem类的具体用法?C# PlayListItem怎么用?C# PlayListItem使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
PlayListItem类属于MediaPortal.Playlists命名空间,在下文中一共展示了PlayListItem类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。
示例1: Load
public bool Load(PlayList playlist, string fileName)
{
playlist.Clear();
XmlNodeList nodeEntries;
if (!LoadXml(fileName, out nodeEntries))
return false;
try
{
string basePath = Path.GetDirectoryName(Path.GetFullPath(fileName));
foreach (XmlNode node in nodeEntries)
{
string file = ReadFileName(node);
if (file == null)
return false;
string infoLine = ReadInfoLine(node, file);
int duration = ReadLength(node);
SetupTv.Utils.GetQualifiedFilename(basePath, ref file);
PlayListItem newItem = new PlayListItem(infoLine, file, duration);
playlist.Add(newItem);
}
return true;
}
catch (Exception)
{
return false;
}
}
开发者ID:arangas,项目名称:MediaPortal-1,代码行数:32,代码来源:PlayListB4sIO.cs
示例2: NewlyAddedSongsAreNotMarkedPlayed
public void NewlyAddedSongsAreNotMarkedPlayed()
{
PlayList pl = new PlayList();
PlayListItem item = new PlayListItem("my song", "myfile.mp3");
pl.Add(item);
Assert.IsFalse(pl.AllPlayed());
}
开发者ID:arangas,项目名称:MediaPortal-1,代码行数:8,代码来源:PlayListTest.cs
示例3: Add
public void Add(PlayListItem item)
{
_playlist.Add(item);
GUIListItem guiItem = new GUIListItem();
guiItem.Label = item.Description;
_playlistDic.Add(guiItem, item);
playlistControl.Add(guiItem);
}
开发者ID:troop,项目名称:MP-Jinzora-Plugin,代码行数:8,代码来源:PlayListGUI.cs
示例4: GetNextReturnsFileName
public void GetNextReturnsFileName()
{
PlayListPlayer player = new PlayListPlayer();
player.CurrentPlaylistType = PlayListType.PLAYLIST_MUSIC;
PlayList playlist = player.GetPlaylist(PlayListType.PLAYLIST_MUSIC);
PlayListItem item1 = new PlayListItem("apa", "c:\\apa.mp3");
playlist.Add(item1);
Assert.AreEqual("c:\\apa.mp3", player.GetNext());
}
开发者ID:arangas,项目名称:MediaPortal-1,代码行数:9,代码来源:PlayListPlayerTest.cs
示例5: InsertItemButNotStartPlayingGivesNull
public void InsertItemButNotStartPlayingGivesNull()
{
PlayListPlayer player = new PlayListPlayer();
player.CurrentPlaylistType = PlayListType.PLAYLIST_MUSIC;
PlayList playlist = player.GetPlaylist(PlayListType.PLAYLIST_MUSIC);
PlayListItem item1 = new PlayListItem();
playlist.Add(item1);
Assert.IsNull(player.GetCurrentItem());
}
开发者ID:arangas,项目名称:MediaPortal-1,代码行数:9,代码来源:PlayListPlayerTest.cs
示例6: RemoveReallyRemovesASong
public void RemoveReallyRemovesASong()
{
PlayList pl = new PlayList();
PlayListItem item = new PlayListItem("my song", "myfile.mp3");
pl.Add(item);
pl.Remove("myfile.mp3");
Assert.AreEqual(0, pl.Count);
}
开发者ID:arangas,项目名称:MediaPortal-1,代码行数:10,代码来源:PlayListTest.cs
示例7: PlayMovesCurrentToItem
public void PlayMovesCurrentToItem()
{
PlayListPlayer player = new PlayListPlayer();
player.g_Player = this; //fake g_Player
player.CurrentPlaylistType = PlayListType.PLAYLIST_MUSIC;
PlayList playlist = player.GetPlaylist(PlayListType.PLAYLIST_MUSIC);
PlayListItem item1 = new PlayListItem();
playlist.Add(item1);
player.PlayNext();
Assert.AreEqual(item1, player.GetCurrentItem());
Assert.IsTrue(hasPlayBeenCalled);
}
开发者ID:arangas,项目名称:MediaPortal-1,代码行数:12,代码来源:PlayListPlayerTest.cs
示例8: AllPlayedReturnsTrueWhenAllArePlayed
public void AllPlayedReturnsTrueWhenAllArePlayed()
{
PlayList pl = new PlayList();
PlayListItem item = new PlayListItem("my song", "myfile.mp3");
item.Played = true;
pl.Add(item);
item = new PlayListItem("my 2:d song", "myfile2.mp3");
item.Played = true;
pl.Add(item);
Assert.IsTrue(pl.AllPlayed());
}
开发者ID:arangas,项目名称:MediaPortal-1,代码行数:13,代码来源:PlayListTest.cs
示例9: Load
public bool Load(PlayList playlist, string fileName)
{
playlist.Clear();
try
{
string basePath = Path.GetDirectoryName(Path.GetFullPath(fileName));
XmlDocument doc = new XmlDocument();
doc.Load(fileName);
if (doc.DocumentElement == null)
{
return false;
}
XmlNode nodeRoot = doc.DocumentElement.SelectSingleNode("/asx");
if (nodeRoot == null)
{
return false;
}
XmlNodeList nodeEntries = nodeRoot.SelectNodes("entry");
foreach (XmlNode node in nodeEntries)
{
XmlNode srcNode = node.SelectSingleNode("ref");
if (srcNode != null)
{
XmlNode url = srcNode.Attributes.GetNamedItem("href");
if (url != null)
{
if (url.InnerText != null)
{
if (url.InnerText.Length > 0)
{
fileName = url.InnerText;
if (!(fileName.ToLowerInvariant().StartsWith("http") || fileName.ToLowerInvariant().StartsWith("mms") || fileName.ToLowerInvariant().StartsWith("rtp")))
continue;
PlayListItem newItem = new PlayListItem(fileName, fileName, 0);
newItem.Type = PlayListItem.PlayListItemType.Audio;
playlist.Add(newItem);
}
}
}
}
}
return true;
}
catch (Exception ex)
{
Log.Info("exception loading playlist {0} err:{1} stack:{2}", fileName, ex.Message, ex.StackTrace);
}
return false;
}
开发者ID:puenktchen,项目名称:RadioTime,代码行数:51,代码来源:PlayListASXIO.cs
示例10: Load
public bool Load(PlayList playlist, string fileName)
{
playlist.Clear();
try
{
string basePath = Path.GetDirectoryName(Path.GetFullPath(fileName));
XmlDocument doc = new XmlDocument();
doc.Load(fileName);
if (doc.DocumentElement == null)
{
return false;
}
XmlNode nodeRoot = doc.DocumentElement.SelectSingleNode("/smil/body/seq");
if (nodeRoot == null)
{
return false;
}
XmlNodeList nodeEntries = nodeRoot.SelectNodes("media");
foreach (XmlNode node in nodeEntries)
{
XmlNode srcNode = node.Attributes.GetNamedItem("src");
if (srcNode != null)
{
if (srcNode.InnerText != null)
{
if (srcNode.InnerText.Length > 0)
{
fileName = srcNode.InnerText;
Util.Utils.GetQualifiedFilename(basePath, ref fileName);
PlayListItem newItem = new PlayListItem(fileName, fileName, 0);
newItem.Type = PlayListItem.PlayListItemType.Audio;
string description;
description = Path.GetFileName(fileName);
newItem.Description = description;
playlist.Add(newItem);
}
}
}
}
return true;
}
catch (Exception ex)
{
Log.Info("exception loading playlist {0} err:{1} stack:{2}", fileName, ex.Message, ex.StackTrace);
}
return false;
}
开发者ID:arangas,项目名称:MediaPortal-1,代码行数:48,代码来源:PlayListWPLIO.cs
示例11: ResetSetsAllItemsToFalse
public void ResetSetsAllItemsToFalse()
{
PlayList pl = new PlayList();
PlayListItem item = new PlayListItem("my song", "myfile.mp3");
pl.Add(item);
PlayListItem item2 = new PlayListItem("my 2:d song", "myfile2.mp3");
pl.Add(item2);
pl[0].Played = true;
pl[1].Played = true;
pl.ResetStatus();
Assert.IsFalse(pl[0].Played);
Assert.IsFalse(pl[1].Played);
}
开发者ID:arangas,项目名称:MediaPortal-1,代码行数:17,代码来源:PlayListTest.cs
示例12: CreatePlaylistItemFromVideoFile
/// <summary>
/// Create playlist item from a file
/// </summary>
/// <param name="file">Path to file</param>
/// <returns>Playlist item</returns>
internal static MediaPortal.Playlists.PlayListItem CreatePlaylistItemFromVideoFile(string file)
{
FileInfo info = new FileInfo(file);
MediaPortal.Playlists.PlayListItem item = new MediaPortal.Playlists.PlayListItem();
item.Description = info.Name;
item.FileName = info.FullName;
item.Type = PlayListItem.PlayListItemType.Video;
//item.Duration
IMDBMovie movie = new IMDBMovie();
int id = VideoDatabase.GetMovieInfo(file, ref movie);
if (id > 0)
{
item.Duration = movie.RunTime;
}
return item;
}
开发者ID:johanj,项目名称:WifiRemote,代码行数:23,代码来源:MpVideosHelper.cs
示例13: Load
public bool Load(PlayList playlist, string playlistFileName)
{
playlist.Clear();
try
{
var doc = new XmlDocument();
doc.Load(playlistFileName);
if (doc.DocumentElement == null)
return false;
XmlNode nodeRoot = doc.DocumentElement.SelectSingleNode("/smil/body/seq");
if (nodeRoot == null)
return false;
XmlNodeList nodeEntries = nodeRoot.SelectNodes("media");
if (nodeEntries != null)
foreach (XmlNode node in nodeEntries)
{
XmlNode srcNode = node.Attributes.GetNamedItem("src");
if (srcNode != null)
{
if (srcNode.InnerText != null)
{
if (srcNode.InnerText.Length > 0)
{
var playlistUrl = srcNode.InnerText;
var newItem = new PlayListItem(playlistUrl, playlistUrl, 0)
{
Type = PlayListItem.PlayListItemType.Audio
};
string description = Path.GetFileName(playlistUrl);
newItem.Description = description;
playlist.Add(newItem);
}
}
}
}
return true;
}
catch (Exception e)
{
Log.Error(e.StackTrace);
}
return false;
}
开发者ID:arangas,项目名称:MediaPortal-1,代码行数:44,代码来源:PlayListWPLIO.cs
示例14: Load
public bool Load(PlayList playlist, string fileName)
{
playlist.Clear();
XmlNodeList nodeEntries;
if (!LoadXml(fileName, out nodeEntries))
{
return false;
}
try
{
string basePath = Path.GetDirectoryName(Path.GetFullPath(fileName));
foreach (XmlNode node in nodeEntries)
{
string file = ReadFileName(node);
if (file == null)
{
return false;
}
string infoLine = ReadInfoLine(node, file);
int duration = ReadLength(node);
file = PathUtil.GetAbsolutePath(basePath, file);
PlayListItem newItem = new PlayListItem(infoLine, file, duration);
playlist.Add(newItem);
}
return true;
}
catch (Exception ex)
{
Log.Info("exception loading playlist {0} err:{1} stack:{2}", fileName, ex.Message, ex.StackTrace);
return false;
}
}
开发者ID:puenktchen,项目名称:MPExtended,代码行数:37,代码来源:PlayListB4sIO.cs
示例15: AddItemToPlayList
protected override void AddItemToPlayList(GUIListItem listItem)
{
if (listItem.IsFolder)
{
// recursive
if (listItem.Label == "..")
{
return;
}
List<GUIListItem> itemlist = _virtualDirectory.GetDirectoryUnProtectedExt(listItem.Path, true);
foreach (GUIListItem item in itemlist)
{
AddItemToPlayList(item);
}
}
else
{
if (Util.Utils.IsVideo(listItem.Path) && !PlayListFactory.IsPlayList(listItem.Path))
{
PlayListItem playlistItem = new PlayListItem();
playlistItem.FileName = listItem.Path;
playlistItem.Description = listItem.Label;
playlistItem.Duration = listItem.Duration;
playlistItem.Type = PlayListItem.PlayListItemType.Video;
_playlistPlayer.GetPlaylist(PlayListType.PLAYLIST_VIDEO).Add(playlistItem);
}
}
}
开发者ID:gayancc,项目名称:MediaPortal-1,代码行数:30,代码来源:GUIVideoFiles.cs
示例16: OnPlayFiles
protected void OnPlayFiles(System.Collections.ArrayList filesList)
{
playlistPlayer.GetPlaylist(PlayListType.PLAYLIST_VIDEO_TEMP).Clear();
playlistPlayer.GetPlaylist(PlayListType.PLAYLIST_VIDEO).Clear();
foreach (string file in filesList)
{
PlayListItem item = new PlayListItem();
item.FileName = file;
item.Type = PlayListItem.PlayListItemType.Video;
item.Description = file;
playlistPlayer.GetPlaylist(PlayListType.PLAYLIST_VIDEO).Add(item);
}
if (playlistPlayer.GetPlaylist(PlayListType.PLAYLIST_VIDEO).Count > 0)
{
GUIWindowManager.ActivateWindow((int)GUIWindow.Window.WINDOW_VIDEO_PLAYLIST);
playlistPlayer.CurrentPlaylistType = PlayListType.PLAYLIST_VIDEO;
playlistPlayer.Reset();
playlistPlayer.Play(0);
}
}
开发者ID:npcomplete111,项目名称:MediaPortal-1,代码行数:22,代码来源:GUIVideoBaseWindow.cs
示例17: AddItemToPlayList
protected virtual void AddItemToPlayList(GUIListItem pItem)
{
if (!pItem.IsFolder)
{
//TODO
if (Util.Utils.IsVideo(pItem.Path) && !PlayListFactory.IsPlayList(pItem.Path))
{
PlayListItem playlistItem = new PlayListItem();
playlistItem.Type = PlayListItem.PlayListItemType.Video;
playlistItem.FileName = pItem.Path;
playlistItem.Description = pItem.Label;
playlistItem.Duration = pItem.Duration;
playlistPlayer.GetPlaylist(PlayListType.PLAYLIST_VIDEO).Add(playlistItem);
}
}
}
开发者ID:npcomplete111,项目名称:MediaPortal-1,代码行数:16,代码来源:GUIVideoBaseWindow.cs
示例18: player_PlayBegin
void player_PlayBegin(YoutubePlaylistPlayer playlit, PlayListItem item)
{
try
{
//ClearLabels("NowPlaying");
VideoInfo info = item.MusicTag as VideoInfo;
if (info == null)
return;
Log.Debug("YouTube.fm playback started");
YouTubeEntry en = info.Entry;
if (en.Authors.Count == 0)
{
Uri videoEntryUrl = new Uri("http://gdata.youtube.com/feeds/api/videos/" + Youtube2MP.GetVideoId(en));
try
{
Video video = Youtube2MP.request.Retrieve<Video>(videoEntryUrl);
en = video.YouTubeEntry;
}
catch (Exception)
{
//vid = null;
}
}
en.Title.Text = item.Description;
item.FileName = Youtube2MP.StreamPlaybackUrl(en, info);
ClearLabels("NowPlaying",true);
ClearLabels("Next", true);
Youtube2MP.NowPlayingEntry = en;
Youtube2MP.NextPlayingEntry = null;
//ArtistManager.Instance.SetSkinProperties(Youtube2MP.NextPlayingEntry, "NowPlaying", false, false);
if (playlit.GetNextItem() != null)
{
VideoInfo nextinfo = playlit.GetNextItem().MusicTag as VideoInfo;
if (nextinfo != null)
{
Youtube2MP.NextPlayingEntry = nextinfo.Entry;
//ArtistManager.Instance.SetSkinProperties(Youtube2MP.NextPlayingEntry, "Next", false, false);
}
}
BackgroundWorker playBeginWorker = new BackgroundWorker();
playBeginWorker.DoWork += playBeginWorker_DoWork;
playBeginWorker.RunWorkerAsync();
Youtube2MP.YouTubePlaying = true;
GUIPropertyManager.SetProperty("#Youtube.fm.FullScreen.ShowTitle", "true");
GUIPropertyManager.SetProperty("#Youtube.fm.FullScreen.ShowNextTitle",
Youtube2MP.NextPlayingEntry != null ? "true" : "false");
_labelTimer.Stop();
_labelTimer.Start();
}
catch (Exception exception)
{
Log.Error("Youtube play begin exception");
Log.Error(exception);
}
}
开发者ID:andrewjswan,项目名称:youtube-fm-for-mediaportal,代码行数:58,代码来源:YouTubeGUIInfo.cs
示例19: SavePlayList
private void SavePlayList()
{
string strNewFileName = playlistPlayer.CurrentPlaylistName;
if (GetKeyboard(ref strNewFileName))
{
string strPath = Path.GetFileNameWithoutExtension(strNewFileName);
string strPlayListPath = string.Empty;
using (Profile.Settings xmlreader = new Profile.MPSettings())
{
strPlayListPath = xmlreader.GetValueAsString("music", "playlists", string.Empty);
strPlayListPath = Util.Utils.RemoveTrailingSlash(strPlayListPath);
}
strPath += ".m3u";
if (strPlayListPath.Length != 0)
{
strPath = strPlayListPath + @"\" + strPath;
}
PlayList playlist = new PlayList();
for (int i = 0; i < facadeLayout.Count; ++i)
{
GUIListItem pItem = facadeLayout[i];
PlayListItem newItem = new PlayListItem();
newItem.FileName = pItem.Path;
newItem.Description = pItem.Label;
newItem.Duration = pItem.Duration;
newItem.Type = PlayListItem.PlayListItemType.Audio;
playlist.Add(newItem);
}
IPlayListIO saver = new PlayListM3uIO();
saver.Save(playlist, strPath);
}
}
开发者ID:akhilgt,项目名称:MediaPortal-1,代码行数:33,代码来源:GUIMusicPlaylist.cs
示例20: AddRandomSongToPlaylist
private bool AddRandomSongToPlaylist(ref Song song)
{
//check duplication
PlayList playlist = playlistPlayer.GetPlaylist(PlayListType.PLAYLIST_MUSIC);
for (int i = 0; i < playlist.Count; i++)
{
PlayListItem item = playlist[i];
if (item.FileName == song.FileName)
{
return false;
}
}
//add to playlist
PlayListItem playlistItem = new PlayListItem();
playlistItem.Type = PlayListItem.PlayListItemType.Audio;
StringBuilder sb = new StringBuilder();
playlistItem.FileName = song.FileName;
sb.Append(song.Track);
sb.Append(". ");
sb.Append(song.Artist);
sb.Append(" - ");
sb.Append(song.Title);
playlistItem.Description = sb.ToString();
playlistItem.Duration = song.Duration;
MusicTag tag = new MusicTag();
tag = song.ToMusicTag();
playlistItem.MusicTag = tag;
playlistPlayer.GetPlaylist(PlayListType.PLAYLIST_MUSIC).Add(playlistItem);
return true;
}
开发者ID:akhilgt,项目名称:MediaPortal-1,代码行数:35,代码来源:GUIMusicPlaylist.cs
注:本文中的MediaPortal.Playlists.PlayListItem类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论