コード例 #1
0
ファイル: MediaDataManager.cs プロジェクト: gsterjov/fusemc
        /// <summary>
        /// Adds the media to the database.
        /// </summary>
        public void AddMedia(FolderMedia media)
        {
            int folder_id = GetFolderID (media.Folder);

            if (folder_id > -1)
                addMedia (media, folder_id, -1);
        }
コード例 #2
0
ファイル: MediaStore.cs プロジェクト: gsterjov/fusemc
 // add media to the folder
 public void AddMedia(string path, Folder folder)
 {
     FolderMedia media = new FolderMedia (path, folder);
     if (media.LoadTag ())
     {
         folder.MediaList.Add (media);
         AddMedia (media);
         data_manager.AddMedia (media);
     }
 }
コード例 #3
0
ファイル: FolderDataManager.cs プロジェクト: gsterjov/fusemc
        /// <summary>
        /// Retrieves all the media from the database.
        /// </summary>
        public void LoadMedia(Folder folder)
        {
            int folder_id = GetFolderID (folder);

            StringBuilder sb = new StringBuilder ();
            sb.AppendFormat ("SELECT path,artist,title,album,comment,year,track_number,track_count,duration FROM media WHERE folder_id={0}", parse(folder_id));

            ExecuteQuery (sb.ToString (), delegate (IDataReader reader) {
                while (reader.Read ())
                {
                    string path = reader.GetString (0);
                    string artist = reader.GetString (1);
                    string title = reader.GetString (2);
                    string album = reader.GetString (3);
                    string comment = reader.GetString (4);
                    int year = reader.GetInt32 (5);
                    int track_number = reader.GetInt32 (6);
                    int track_count = reader.GetInt32 (7);
                    TimeSpan duration = TimeSpan.FromSeconds (reader.GetDouble (8));

                    FolderMedia media = new FolderMedia (path, folder);
                    media.Artist = artist;
                    media.Title = title;
                    media.Album = album;
                    media.Comment = comment;
                    media.Year = year;
                    media.TrackNumber = track_number;
                    media.TrackCount = track_count;
                    media.Duration = duration;

                    folder.MediaList.Add (media);
                }
            });
        }