当前位置: 首页>>代码示例>>C#>>正文


C# Database.Song类代码示例

本文整理汇总了C#中MediaPortal.Music.Database.Song的典型用法代码示例。如果您正苦于以下问题:C# Song类的具体用法?C# Song怎么用?C# Song使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


Song类属于MediaPortal.Music.Database命名空间,在下文中一共展示了Song类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: NowPlayingMusic

        public NowPlayingMusic(Song song)
        {
            ItemId = song.Id;
            Album = song.Album;
            AlbumArtist = song.AlbumArtist;
            Artist = song.Artist;
            BitRate = song.BitRate;
            BitRateMode = song.BitRateMode;
            BPM = song.BPM;
            Channels = song.Channels;
            Codec = song.Codec;
            Comment = song.Comment;
            Composer = song.Composer;
            Conductor = song.Conductor;
            DateTimeModified = song.DateTimeModified;
            DateTimePlayed = song.DateTimePlayed;
            DiscId = song.DiscId;
            DiscTotal = song.DiscTotal;
            Duration = song.Duration;
            Genre = song.Genre;
            Lyrics = song.Lyrics;
            Rating = song.Rating;
            SampleRate = song.SampleRate;
            TimesPlayed = song.TimesPlayed;
            Title = song.Title;
            Track = song.Track;
            TrackTotal = song.TrackTotal;
            URL = song.URL;
            WebImage = song.WebImage;
            Year = song.Year;

            ImageName = MediaPortal.Util.Utils.GetAlbumThumbName(song.Artist, song.Album);
            ImageName = MediaPortal.Util.Utils.ConvertToLargeCoverArt(ImageName);
        }
开发者ID:johanj,项目名称:WifiRemote,代码行数:34,代码来源:NowPlayingMusic.cs

示例2: QueuedTrack

 public QueuedTrack(Song track)
 {
   this.artist = track.Artist;
   this.title = track.Title;
   this.start_time = track.getQueueTime(true);
   this.source = track.getSourceParam();
   this.rating = track.getRateActionParam();
   this.duration = (int)track.Duration;
   this.album = track.Album;
   this.tracknr = track.Track;
   this.auth = track.AuthToken;
 }
开发者ID:npcomplete111,项目名称:MediaPortal-1,代码行数:12,代码来源:AudioscrobblerQueue.cs

示例3: AddMpExtendedInfo

        /// <summary>
        /// Add MpExtended information to playlist item
        /// </summary>
        /// <param name="item">MediaPortal playlist item</param>
        /// <param name="message">Playlist message item that is sent to client</param>
        internal static void AddMpExtendedInfo(MediaPortal.Playlists.PlayListItem item, PlaylistEntry message)
        {
            MusicDatabase mpMusicDb = MusicDatabase.Instance;
            Song song = new Song();
            bool inDb = mpMusicDb.GetSongByFileName(item.FileName, ref song);

            if (inDb)
            {
                message.Name2 = song.Album;
                message.AlbumArtist = song.AlbumArtist;
                message.Title = song.Title;
                message.MpExtId = song.Id.ToString();
                message.MpExtMediaType = (int)MpExtended.MpExtendedMediaTypes.MusicTrack;
                message.MpExtProviderId = (int)MpExtended.MpExtendedProviders.MPMusic;
            }
        }
开发者ID:johanj,项目名称:WifiRemote,代码行数:21,代码来源:MpMusicHelper.cs

示例4: AssignAllSongFieldsFromResultSet

    public bool AssignAllSongFieldsFromResultSet(ref Song aSong, SQLiteResultSet aResult, int aRow)
    {
      if (aSong == null || aResult == null || aResult.Rows.Count < 1)
      {
        return false;
      }

      aSong.Id = DatabaseUtility.GetAsInt(aResult, aRow, "tracks.idTrack");
      aSong.FileName = DatabaseUtility.Get(aResult, aRow, "tracks.strPath");
      aSong.Artist = DatabaseUtility.Get(aResult, aRow, "tracks.strArtist").Trim(trimChars);
      aSong.AlbumArtist = DatabaseUtility.Get(aResult, aRow, "tracks.strAlbumArtist").Trim(trimChars);
      aSong.Album = DatabaseUtility.Get(aResult, aRow, "tracks.strAlbum");
      aSong.Genre = DatabaseUtility.Get(aResult, aRow, "tracks.strGenre").Trim(trimChars);
      aSong.Title = DatabaseUtility.Get(aResult, aRow, "tracks.strTitle");
      aSong.Track = DatabaseUtility.GetAsInt(aResult, aRow, "tracks.iTrack");
      aSong.TrackTotal = DatabaseUtility.GetAsInt(aResult, aRow, "tracks.iNumTracks");
      aSong.Duration = DatabaseUtility.GetAsInt(aResult, aRow, "tracks.iDuration");
      aSong.Year = DatabaseUtility.GetAsInt(aResult, aRow, "tracks.iYear");
      aSong.TimesPlayed = DatabaseUtility.GetAsInt(aResult, aRow, "tracks.iTimesPlayed");
      aSong.Rating = DatabaseUtility.GetAsInt(aResult, aRow, "tracks.iRating");
      aSong.Favorite = DatabaseUtility.GetAsInt(aResult, aRow, "tracks.iFavorite") != 0;
      aSong.ResumeAt = DatabaseUtility.GetAsInt(aResult, aRow, "tracks.iResumeAt");
      aSong.DiscId = DatabaseUtility.GetAsInt(aResult, aRow, "tracks.iDisc");
      aSong.DiscTotal = DatabaseUtility.GetAsInt(aResult, aRow, "tracks.iNumDisc");
      aSong.Lyrics = DatabaseUtility.Get(aResult, aRow, "tracks.strLyrics");
      aSong.Composer = DatabaseUtility.Get(aResult, aRow, "tracks.strComposer").Trim(trimChars);
      aSong.Conductor = DatabaseUtility.Get(aResult, aRow, "tracks.strConductor").Trim(trimChars);
      aSong.Comment = DatabaseUtility.Get(aResult, aRow, "tracks.strComment").Trim(trimChars);
      aSong.FileType = DatabaseUtility.Get(aResult, aRow, "tracks.strFileType").Trim(trimChars);
      aSong.Codec = DatabaseUtility.Get(aResult, aRow, "tracks.strFullCodec").Trim(trimChars);
      aSong.BitRateMode = DatabaseUtility.Get(aResult, aRow, "tracks.strBitRateMode").Trim(trimChars);
      aSong.BPM = DatabaseUtility.GetAsInt(aResult, aRow, "tracks.iBPM");
      aSong.BitRate = DatabaseUtility.GetAsInt(aResult, aRow, "tracks.iBitRate");
      aSong.Channels = DatabaseUtility.GetAsInt(aResult, aRow, "tracks.iChannels");
      aSong.SampleRate = DatabaseUtility.GetAsInt(aResult, aRow, "tracks.iSampleRate");
      try
      {
        aSong.DateTimePlayed = DatabaseUtility.GetAsDateTime(aResult, aRow, "dateLastPlayed");
        aSong.DateTimeModified = DatabaseUtility.GetAsDateTime(aResult, aRow, "dateAdded");
      }
      catch (Exception ex)
      {
        Log.Warn("MusicDatabase Lookup: Exception parsing date fields: {0} stack: {1}", ex.Message, ex.StackTrace);
      }
      return true;
    }
开发者ID:djblu,项目名称:MediaPortal-1,代码行数:46,代码来源:MusicDatabase.Lookups.cs

示例5: AddItemToPlaylist

        /// <summary>
        /// Adds a song to a playlist
        /// </summary>
        /// <param name="type">Type of the playlist</param>
        /// <param name="entry">Item that gets added</param>
        /// <param name="index">Index where the item should be added</param>
        /// <param name="refresh">Should the playlist be refreshed after the item is added</param>
        public static void AddItemToPlaylist(String type, PlaylistEntry entry, int index, bool refresh)
        {
            PlayListType plType = GetTypeFromString(type);
            PlayListPlayer playListPlayer = PlayListPlayer.SingletonPlayer;
            PlayList playList = playListPlayer.GetPlaylist(plType);
            PlayListItem item = null;

            //If it's a music item, try to find it in the db
            if (plType == PlayListType.PLAYLIST_MUSIC)
            {
                MusicDatabase mpMusicDb = MusicDatabase.Instance;
                Song song = new Song();
                bool inDb = mpMusicDb.GetSongByFileName(entry.FileName, ref song);

                if (inDb)
                {
                    item = ToPlayListItem(song);
                }
            }
            else if (plType == PlayListType.PLAYLIST_VIDEO)
            {
                IMDBMovie movie = new IMDBMovie();
                int id = VideoDatabase.GetMovieInfo(entry.FileName, ref movie);

                if (id > 0)
                {
                    item = ToPlayListItem(movie);
                }
            }

            if (item == null)
            {
                item = new PlayListItem(entry.Name, entry.FileName, entry.Duration);
            }

            playList.Insert(item, index);

            if (refresh)
            {
                RefreshPlaylistIfVisible();
            }
        }
开发者ID:Kucheek,项目名称:WifiRemote,代码行数:49,代码来源:PlaylistHelper.cs

示例6: ShowSong

    private void ShowSong()
    {
      GUIDialogNotify dlg = (GUIDialogNotify)GUIWindowManager.GetWindow((int)Window.WINDOW_DIALOG_NOTIFY);
      if (dlg == null)
      {
        return;
      }

      //get albumart
      string albumart = g_Player.CurrentFile;
      int e = albumart.LastIndexOf(@"\") + 1;
      albumart = albumart.Remove(e);
      if (_slideList[_currentSlideIndex].Contains(albumart))
      {
        albumart = string.Empty;
      }
      else
      {
        albumart = Util.Utils.GetFolderThumbForDir(albumart);
        if (!Util.Utils.FileExistsInCache(albumart))
        {
          albumart = string.Empty;
        }
      }
      // get Song-info

      // hwahrmann 2006-11-22 Using the Tagreader caused a COM exception in Win Media SDK, when reading WMA files
      // Accessing the Music Database instead of using the Tagreader.
      //MediaPortal.TagReader.MusicTag tag = MediaPortal.TagReader.TagReader.ReadTag(g_Player.CurrentFile);
      Song song = new Song();

      // If we don't have a tag in the db, we use the filename without the extension as song.title
      song.Title = Path.GetFileNameWithoutExtension(g_Player.CurrentFile);
      mDB.GetSongByFileName(g_Player.CurrentFile, ref song);

      // Show Dialog
      dlg.Reset();
      dlg.Dispose();
      dlg.SetImage(albumart);
      dlg.SetHeading(4540);
      //dlg.SetText(tag.Title + "\n" + tag.Artist + "\n" + tag.Album);
      dlg.SetText(song.Title + "\n" + song.Artist + "\n" + song.Album);
      dlg.TimeOut = 5;
      dlg.DoModal(GUIWindowManager.ActiveWindow);
    }
开发者ID:npcomplete111,项目名称:MediaPortal-1,代码行数:45,代码来源:GUISlideShow.cs

示例7: Clone

    public Song Clone()
    {
      var newsong = new Song
                      {
                        Id = Id,
                        Album = Album,
                        Artist = Artist,
                        AlbumArtist = AlbumArtist,
                        Duration = Duration,
                        FileName = FileName,
                        Genre = Genre,
                        Composer = Composer,
                        Conductor = Conductor,
                        TimesPlayed = TimesPlayed,
                        Title = Title,
                        Track = Track,
                        TrackTotal = TrackTotal,
                        Year = Year,
                        Rating = Rating,
                        Favorite = Favorite,
                        DateTimeModified = DateTimeModified,
                        DateTimePlayed = DateTimePlayed,
                        URL = URL,
                        ResumeAt = ResumeAt,
                        DiscId = DiscId,
                        DiscTotal = DiscTotal,
                        Lyrics = Lyrics,
                        AuthToken = AuthToken,
                        Comment = Comment,
                        FileType = FileType,
                        Codec = Codec,
                        BitRateMode = BitRateMode,
                        BPM = BPM,
                        Channels = Channels,
                        SampleRate = SampleRate
                      };

      return newsong;
    }
开发者ID:arangas,项目名称:MediaPortal-1,代码行数:39,代码来源:Song.cs

示例8: AddSongToPlaylist

    /// <summary>
    /// Add or enque a song to the current playlist - call OnSongInserted() after this!!!
    /// </summary>
    /// <param name="song">the song to add</param>
    /// <returns>if the action was successful</returns>
    private bool AddSongToPlaylist(ref Song song)
    {
      PlayList playlist;
      if (PlaylistPlayer.CurrentPlaylistType == PlayListType.PLAYLIST_MUSIC_TEMP)
      {
        playlist = PlaylistPlayer.GetPlaylist(PlayListType.PLAYLIST_MUSIC_TEMP);
      }
      else
      {
        playlist = PlaylistPlayer.GetPlaylist(PlayListType.PLAYLIST_MUSIC);
      }
      
      if (playlist == null)
      {
        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;

      playlistItem.MusicTag = song.ToMusicTag();
      playlist.Add(playlistItem);

      OnSongInserted();
      return true;
    }
开发者ID:cmendozac,项目名称:MediaPortal-1,代码行数:42,代码来源:GUIMusicPlayingNow.cs

示例9: 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

示例10: IncrTop100CounterByFileName

    public bool IncrTop100CounterByFileName(string aFileName)
    {
      try
      {
        Song song = new Song();
        string strFileName = aFileName;
        DatabaseUtility.RemoveInvalidChars(ref strFileName);

        strSQL = String.Format("SELECT * from tracks WHERE strPath = '{0}'", strFileName);

        SQLiteResultSet results = MusicDbClient.Execute(strSQL);
        if (results.Rows.Count == 0)
        {
          return false;
        }

        int idSong = DatabaseUtility.GetAsInt(results, 0, "idTrack");
        int iTimesPlayed = DatabaseUtility.GetAsInt(results, 0, "iTimesPlayed");

        strSQL = String.Format("UPDATE tracks SET iTimesPlayed={0}, dateLastPlayed='{1}' where idTrack='{2}'", 
          ++iTimesPlayed, DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"), idSong);
        if (DirectExecute(strSQL).Rows.Count > 0)
        {
          Log.Debug("MusicDatabase: increased playcount for song {1} to {0}", Convert.ToString(iTimesPlayed), aFileName);
          return true;
        }
      }
      catch (Exception ex)
      {
        Log.Error("musicdatabase exception err:{0} stack:{1}", ex.Message, ex.StackTrace);
        Open();
      }

      return false;
    }
开发者ID:nio22,项目名称:MediaPortal-1,代码行数:35,代码来源:MusicDatabase.Updates.cs

示例11: DoUpdateArtistInfo

    private void DoUpdateArtistInfo(ArtistInfoRequest request, Song song)
    {
      // artist tag can contain multiple artists and 
      // will be separated by " | " so split by | then trim
      // so we will add one thumb for artist
      String[] strArtists = CurrentTrackTag.Artist.Split('|');
      foreach (String strArtist in strArtists)
      {
        CurrentThumbFileName = Util.Utils.GetCoverArtName(Thumbs.MusicArtists,
                                                          Util.Utils.MakeFileName(strArtist.Trim()));
        if (CurrentThumbFileName.Length > 0)
        {
          // let us test if there is a larger cover art image
          string strLarge = Util.Utils.ConvertToLargeCoverArt(CurrentThumbFileName);
          if (Util.Utils.FileExistsInCache(strLarge))
          {
            CurrentThumbFileName = strLarge;
          }

          AddImageToImagePathContainer(CurrentThumbFileName);
          UpdateImagePathContainer();
        }
      }
    }
开发者ID:sanyaade-embedded-systems,项目名称:MediaPortal-1,代码行数:24,代码来源:GUIMusicPlayingNow.cs

示例12: OnUpdateArtistInfoCompleted

 public void OnUpdateArtistInfoCompleted(ArtistInfoRequest request, Song song)
 {
   if (request.Equals(_lastArtistRequest))
   {
     GUIGraphicsContext.form.Invoke(new ArtistInfoCompletedDelegate(DoUpdateArtistInfo), new object[] {request, song});
   }
   else
   {
     Log.Warn("NowPlaying.OnUpdateArtistInfoCompleted: unexpected response for request: {0}", request.Type);
   }
 }
开发者ID:sanyaade-embedded-systems,项目名称:MediaPortal-1,代码行数:11,代码来源:GUIMusicPlayingNow.cs

示例13: AddInfoTrackToPlaylist

    private void AddInfoTrackToPlaylist(GUIListItem chosenTrack_)
    {
      try
      {
        MusicDatabase mdb = MusicDatabase.Instance;
        Song addSong = new Song();
        MusicTag tempTag = new MusicTag();
        tempTag = (MusicTag)chosenTrack_.MusicTag;

        if (mdb.GetSongByMusicTagInfo(tempTag.Artist, tempTag.Album, tempTag.Title, true, ref addSong))
        {
          if (AddSongToPlaylist(ref addSong))
          {
            Log.Info("GUIMusicPlayingNow: Song inserted: {0} - {1}", addSong.Artist, addSong.Title);
          }
        }
        else
        {
          Log.Info("GUIMusicPlayingNow: DB lookup for Artist: {0} Title: {1} unsuccessful", tempTag.Artist,
                   tempTag.Title);
        }
      }
      catch (Exception ex)
      {
        Log.Error("GUIMusicPlayingNow: DB lookup for Song failed - {0}", ex.Message);
      }
    }
开发者ID:sanyaade-embedded-systems,项目名称:MediaPortal-1,代码行数:27,代码来源:GUIMusicPlayingNow.cs

示例14: SetLevelForPlayback

        private void SetLevelForPlayback(string mediaType, string Level)
        {
            if ((previousLevel == "Play" || previousLevel == "Pause") && (Level == "Play") && (previousMediaType != mediaType))
            {
                previousLevel = "Stop";
            }
            string part2String;
            string part3String;
            string lengthString = "";
            string Genre = "";
            string CurrentFile = "";
            string SearchFile = "";
            if (!mediaType.Equals("Plugin"))
            {
                if ((mediaType == g_Player.MediaType.Video.ToString()) || mediaType == g_Player.MediaType.Recording.ToString())
                {
                    if (g_Player.Duration < (setLevelForMediaDuration * 60))
                    {
                        if (DebugMode) Logger.Debug("Length is Short");
                        lengthString = "Short.";
                    }
                    else
                    {
                        if (DebugMode) Logger.Debug("Length is Long");
                        lengthString = "Long.";
                    }
                }
                if (g_Player.IsDVD)
                {
                    if (DebugMode) Logger.Debug("Length is Long (Media is DVD)");
                    lengthString = "Long.";
                }

                if (Level == "Play")
                {
                    CurrentFile = g_Player.Player.CurrentFile;
                    SearchFile = CurrentFile;
                    if (g_Player.IsMusic)
                    {
                        Song song = new Song();
                        MusicDatabase musicDatabase = MusicDatabase.Instance;
                        musicDatabase.GetSongByFileName(SearchFile, ref song);
                        if (song != null)
                        {
                            Genre = song.Genre.ToString();
                        }
                    }
                    if (g_Player.IsVideo)
                    {
                        if (!SearchFile.StartsWith("http://localhost/")) // Online Video is not in DB so skip DB Search
                        {
                            try
                            {
                                if (DebugMode) Logger.Debug("Check to see if the video is a mounted disc.");
                                SearchFile = MountHelper.CheckMount(ref SearchFile);
                            }
                            catch
                            {
                                Logger.Warning("Daemontools not installed/configured");
                            }
                            if (DebugMode) Logger.Debug("Check to see if video is in MyVideos database.");
                            IMDBMovie movie = new IMDBMovie();
                            int movieID = VideoDatabase.GetMovieId(SearchFile);
                            VideoDatabase.GetMovieInfoById(movieID, ref movie);
                            if (movie.ID > 0)
                            {
                                if (DebugMode) Logger.Debug("Video is in MyVideos database.");
                                Genre = movie.Genre.ToString();
                            }
                            else // Movie not in MyVideo's DB
                            {
                                if (DebugMode) Logger.Debug("Video is not in MyVideos database.");
                                if (DebugMode) Logger.Debug("Check to see if video is in MovingPictures database.");
                                try
                                {
                                    if (Genre.Equals("")) Genre = MovingPicturesHelper.CheckDB(ref SearchFile);
                                }
                                catch
                                {
                                    Logger.Warning("Error while searching MovingPictures Database, probaly not installed");
                                }
                                if (DebugMode) Logger.Debug("Check to see if video is in TVSeries database.");
                                try
                                {
                                    if (Genre.Equals("")) Genre = TVSeriesHelper.CheckDB(SearchFile);
                                }
                                catch
                                {
                                    Logger.Warning("Error while searching TVSeries Database, probaly not installed");
                                }
                            }
                        }
                        else
                        {
                            if (DebugMode) Logger.Debug("Media is OnlineVideo");
                        }
                    }
                }
            }
            part2String = (egPart2.Equals("Type")) ? mediaType : Level;
//.........这里部分代码省略.........
开发者ID:RickDB,项目名称:EventGhostPlus,代码行数:101,代码来源:EventGhostPlus.cs

示例15: GetFieldValue

 public static string GetFieldValue(Song song, string where)
 {
   if (where == "album")
   {
     return song.Album;
   }
   if (where == "artist")
   {
     return song.Artist;
   }
   if (where == "albumartist")
   {
     return song.AlbumArtist;
   }
   if (where == "title")
   {
     return song.Title;
   }
   if (where == "genre")
   {
     return song.Genre;
   }
   if (where == "composer")
   {
     return song.Composer;
   }
   if (where == "conductor")
   {
     return song.Conductor;
   }
   if (where == "year")
   {
     return song.Year.ToString();
   }
   if (where == "track")
   {
     return song.Track.ToString();
   }
   if (where == "timesplayed")
   {
     return song.TimesPlayed.ToString();
   }
   if (where == "rating")
   {
     return song.Rating.ToString();
   }
   if (where == "favorites")
   {
     if (song.Favorite)
     {
       return "1";
     }
     return "0";
   }
   if (where == "recently added")
   {
     return song.DateTimeModified.ToShortDateString();
   }
   if (where == "disc#")
   {
     return song.DiscId.ToString();
   }
   return "";
 }
开发者ID:npcomplete111,项目名称:MediaPortal-1,代码行数:64,代码来源:MusicViewHandler.cs


注:本文中的MediaPortal.Music.Database.Song类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。