本文整理汇总了C#中MediaPortal.Music.Database.Song.Clone方法的典型用法代码示例。如果您正苦于以下问题:C# Song.Clone方法的具体用法?C# Song.Clone怎么用?C# Song.Clone使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类MediaPortal.Music.Database.Song
的用法示例。
在下文中一共展示了Song.Clone方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: DoScrobbleLookups
private void DoScrobbleLookups()
{
PlayList currentPlaylist = playlistPlayer.GetPlaylist(PlayListType.PLAYLIST_MUSIC);
MusicDatabase dbs = MusicDatabase.Instance;
Song current10SekSong = new Song();
List<Song> scrobbledArtists = new List<Song>();
ascrobbler.RemoveRequest(_lastRequest);
switch (currentScrobbleMode)
{
case ScrobbleMode.Similar:
if (_rememberStartTrack && _scrobbleStartTrack != null)
{
if (_totalScrobbledSongs > REINSERT_AFTER_THIS_MANY_SONGS)
{
_totalScrobbledSongs = 0;
Song tmpArtist = new Song();
tmpArtist = _scrobbleStartTrack;
scrobbledArtists.Add(tmpArtist);
break;
}
}
string strFile = string.Empty;
if (g_Player.Player.CurrentFile != null && g_Player.Player.CurrentFile != string.Empty && g_Player.IsMusic)
{
strFile = g_Player.Player.CurrentFile;
bool songFound = dbs.GetSongByFileName(strFile, ref current10SekSong);
if (songFound)
{
if (_scrobbleStartTrack == null || _scrobbleStartTrack.Artist == string.Empty)
{
_scrobbleStartTrack = current10SekSong.Clone();
}
try
{
UpdateSimilarArtists(current10SekSong.Artist);
//scrobbledArtists = ascrobbler.getSimilarArtists(current10SekSong.ToURLArtistString(), _useSimilarRandom);
return;
}
catch (Exception ex)
{
Log.Error("ScrobbleLookupThread: exception on lookup Similar - {0}", ex.Message);
}
}
}
break;
case ScrobbleMode.Neighbours:
//lock (ScrobbleLock)
//{
try
{
UpdateNeighboursArtists(true);
}
catch (Exception ex)
{
Log.Error("ScrobbleLookupThread: exception on lookup Neighbourhood - {0}", ex.Message);
}
//}
break;
case ScrobbleMode.Friends:
//lock (ScrobbleLock)
//{
try
{
UpdateFriendsArtists(true);
}
catch (Exception ex)
{
Log.Error("ScrobbleLookupThread: exception on lookup - Friends {0}", ex.Message);
}
//}
break;
case ScrobbleMode.Random:
try
{
switch (currentOfflineMode)
{
case offlineMode.random:
UpdateRandomTracks();
break;
case offlineMode.timesplayed:
UpdateUnheardTracks();
break;
case offlineMode.favorites:
UpdateFavoriteTracks();
break;
default:
UpdateRandomTracks();
break;
}
}
catch (Exception ex)
{
Log.Error("ScrobbleLookupThread: exception on lookup - Random {0}", ex.Message);
}
//.........这里部分代码省略.........
示例2: fetchRandomTracks
private List<Song> fetchRandomTracks(offlineMode randomMode_)
{
int addedSongs = 0;
MusicDatabase dbs = MusicDatabase.Instance;
List<Song> randomSongList = new List<Song>(_limitRandomListCount);
Song randomSong = new Song();
Song lookupSong = new Song();
int loops = 0;
// fetch more than needed since there could be double entries
while (addedSongs < _limitRandomListCount * 3)
{
loops++;
lookupSong.Clear();
dbs.GetRandomSong(ref lookupSong);
randomSong = lookupSong.Clone();
bool found = false;
for (int i = 0; i < randomSongList.Count; i++)
{
if (randomSongList[i].Artist == randomSong.Artist)
{
found = true;
break;
}
}
if (!found)
{
switch (randomMode_)
{
case offlineMode.timesplayed:
if (randomSong.TimesPlayed == 0)
{
randomSongList.Add(randomSong);
addedSongs++;
}
break;
case offlineMode.favorites:
if (randomSong.Favorite)
{
randomSongList.Add(randomSong);
addedSongs++;
}
break;
case offlineMode.random:
randomSongList.Add(randomSong);
addedSongs++;
break;
}
}
// quick check; 3x rlimit times because every pass could try different artists in dbs.GetRandomSong(ref lookupSong);
if (loops > 20)
{
if (randomMode_ == offlineMode.timesplayed)
{
Log.Debug("AudioScrobblerUtils: Not enough unique unheard tracks for random mode");
}
break;
}
}
return randomSongList;
}
示例3: PlayPlayListStreams
public void PlayPlayListStreams(Song aStreamSong)
{
bool playSuccess = false;
try
{
GUIWaitCursor.Show();
if (g_Player.Playing)
{
g_Player.Stop();
}
LastFMStation.CurrentStreamState = StreamPlaybackState.starting;
_streamSong = aStreamSong;
Song addSong = aStreamSong.Clone();
AddStreamSongToPlaylist(ref addSong);
PlaylistPlayer.CurrentPlaylistType = PlayListType.PLAYLIST_RADIO_STREAMS;
PlayList Playlist = PlaylistPlayer.GetPlaylist(PlaylistPlayer.CurrentPlaylistType);
if (Playlist == null)
{
return;
}
// Avoid an endless loop when a song cannot be played.
PlaylistPlayer.RepeatPlaylist = false;
// I found out, you have to send "Cookie: Session=[sessionID]" in the header of the request of the MP3 file.
PlaylistPlayer.Play(0);
LastFMStation.CurrentStreamState = StreamPlaybackState.streaming;
playSuccess = g_Player.Playing;
}
finally
{
GUIWaitCursor.Hide();
if (!playSuccess)
{
PlayBackFailedHandler();
}
}
}
示例4: filterForLocalSongs
private List<Song> filterForLocalSongs(List<Song> unfilteredList_, bool onlyUniqueArtists, songFilterType filterType)
{
try
{
lock (LookupLock)
{
MusicDatabase mdb = MusicDatabase.Instance;
List<Song> tmpSongs = new List<Song>();
Song tmpSong = new Song();
bool foundDoubleEntry = false;
string tmpArtist = string.Empty;
for (int s = 0; s < unfilteredList_.Count; s++)
{
tmpArtist = unfilteredList_[s].Artist.ToLowerInvariant();
// only accept other artists than the current playing but include current "tag" since some people tag just using the artist's name..
//if (tmpArtist != excludeArtist_.ToLowerInvariant() || tmpArtist == currentTag_)
//{
switch (filterType)
{
case songFilterType.Track:
{
Song dbSong = new Song();
// The filename is unique so try if we get a 100% correct result first
if (!string.IsNullOrEmpty(unfilteredList_[s].FileName))
{
mdb.GetSongByFileName(unfilteredList_[s].FileName, ref dbSong);
}
else
{
mdb.GetSongByMusicTagInfo(AudioscrobblerBase.StripArtistPrefix(unfilteredList_[s].Artist),
unfilteredList_[s].Album, unfilteredList_[s].Title, true, ref dbSong);
}
if (!string.IsNullOrEmpty(dbSong.Artist))
{
tmpSong = dbSong.Clone();
// Log.Debug("Audioscrobber: Track filter for {1} found db song - {0}", tmpSong.FileName, unfilteredList_[s].Title);
foundDoubleEntry = false;
if (onlyUniqueArtists)
{
// check and prevent entries from the same artist
for (int j = 0; j < tmpSongs.Count; j++)
{
if (tmpSong.Artist == tmpSongs[j].Artist)
{
foundDoubleEntry = true;
break;
}
}
}
// new item therefore add it
if (!foundDoubleEntry)
{
//if (currentTag_ != string.Empty)
// tmpSong.Genre = currentTag_;
tmpSongs.Add(tmpSong);
}
}
break;
}
case songFilterType.Artist:
{
String[] artistArray = null;
List<Song> dbArtists = new List<Song>();
ArrayList artistsInDB = new ArrayList();
if (mdb.GetArtists(4, unfilteredList_[s].Artist, ref artistsInDB))
{
artistArray = (String[])artistsInDB.ToArray(typeof (String));
foreach (String singleArtist in artistArray)
{
Song addSong = new Song();
addSong.Artist = singleArtist;
dbArtists.Add(addSong);
}
// only use the first hit for now..
if (dbArtists.Count > 0)
{
foundDoubleEntry = false;
// check and prevent double entries
for (int j = 0; j < tmpSongs.Count; j++)
{
if (dbArtists[0].Artist == (tmpSongs[j].Artist))
{
foundDoubleEntry = true;
break;
}
}
// new item therefore add it
if (!foundDoubleEntry)
{
tmpSongs.Add(unfilteredList_[s]);
}
}
}
break;
}
//.........这里部分代码省略.........