• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C# Database.DatabaseTrackInfo类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: AssertTitleSort

 protected void AssertTitleSort(string title, string title_sort, byte[] expected)
 {
     DatabaseTrackInfo info = new DatabaseTrackInfo ();
     info.TrackTitle = title;
     info.TrackTitleSort = title_sort;
     Assert.AreEqual (expected, info.TrackTitleSortKey);
 }
开发者ID:haugjan,项目名称:banshee-hacks,代码行数:7,代码来源:DatabaseTrackInfoTests.cs


示例2: DefaultTrackPrimarySourceChooser

 protected static PrimarySource DefaultTrackPrimarySourceChooser (DatabaseTrackInfo track)
 {
     if ((track.MediaAttributes & TrackMediaAttributes.VideoStream) != 0) {
         return ServiceManager.SourceManager.VideoLibrary;
     } else {
         return ServiceManager.SourceManager.MusicLibrary;
     }
 }
开发者ID:haugjan,项目名称:banshee-hacks,代码行数:8,代码来源:LibraryImportManager.cs


示例3: CopyTrackTo

 public override void CopyTrackTo (DatabaseTrackInfo track, SafeUri uri, BatchUserJob job)
 {
     if (track.PrimarySource == this && track.Uri.Scheme.StartsWith ("http")) {
         foreach (double percent in database.DownloadTrack ((int)track.ExternalId, track.MimeType, uri.AbsolutePath)) {
             job.DetailedProgress = percent;
         }
     }
 }
开发者ID:gclark916,项目名称:banshee,代码行数:8,代码来源:DaapSource.cs


示例4: Bookmark

        public Bookmark(DatabaseTrackInfo track, int position_ms, string type)
        {
            Track = track;
            Position = TimeSpan.FromMilliseconds (position_ms);
            CreatedAt = DateTime.Now;
            Type = type;

            Save ();
        }
开发者ID:kelsieflynn,项目名称:banshee,代码行数:9,代码来源:Bookmark.cs


示例5: DownloadLyrics

        private void DownloadLyrics(DatabaseTrackInfo track)
        {
            string lyrics = null;
            try {
                lyrics = LyricsManager.Instance.DownloadLyrics (track);
            } catch (Exception e) {
                Log.Warning (e);
                return;
            }

            LyricsManager.Instance.SaveLyrics (track, lyrics, true);
        }
开发者ID:nailyk,项目名称:banshee-community-extensions,代码行数:12,代码来源:LyricsDownloadJob.cs


示例6: PodcastPropertiesDialog

        public PodcastPropertiesDialog (DatabaseTrackInfo track)
        {
            PodcastTrackInfo pi = PodcastTrackInfo.From (track);
            if (pi == null)
            {
                throw new ArgumentNullException ("pi");
            }

            this.pi = pi;

            Title = track.TrackTitle;
            BuildWindow ();
            //IconThemeUtils.SetWindowIcon (this);
        }
开发者ID:haugjan,项目名称:banshee-hacks,代码行数:14,代码来源:PodcastPropertiesDialog.cs


示例7: ContactTrackInfo

        public ContactTrackInfo(DatabaseTrackInfo track, ContactSource source)
            : this()
        {
            if (track == null) {
                throw new ArgumentNullException ("track");
            }
            else if (source == null) {
                throw new ArgumentNullException ("source");
            }

            this.TrackId = track.TrackId;
            this.ExternalId = track.ExternalId;
            this.AlbumTitle = track.AlbumTitle;
            this.ArtistName = track.ArtistName;
            this.TrackNumber = track.TrackNumber;
            this.TrackTitle = track.TrackTitle;
            this.Uri = track.Uri;

            PrimarySource = source;
        }
开发者ID:nloko,项目名称:banshee-telepathy-extension,代码行数:20,代码来源:ContactTrackInfo.cs


示例8: DeleteTrack

        protected override bool DeleteTrack (DatabaseTrackInfo track)
        {
            lock (mtp_device) {
                Track mtp_track = track_map [track.TrackId];
                track_map.Remove (track.TrackId);

                // Remove from device
                mtp_device.Remove (mtp_track);

                // Remove track from album, and remove album from device if it no longer has tracks
                string key = MakeAlbumKey (track.ArtistName, track.AlbumTitle);
                if (album_cache.ContainsKey (key)) {
                    Album album = album_cache[key];
                    album.RemoveTrack (mtp_track);
                    if (album.Count == 0) {
                        album.Remove ();
                        album_cache.Remove (key);
                    }
                }

                return true;
            }
        }
开发者ID:fatman2021,项目名称:gnome-apps,代码行数:23,代码来源:MtpSource.cs


示例9: CopyTrackTo

 public override void CopyTrackTo (DatabaseTrackInfo track, SafeUri uri, BatchUserJob job)
 {
     if (track_map.ContainsKey (track.TrackId)) {
         track_map[track.TrackId].Download (uri.LocalPath, delegate (ulong current, ulong total, IntPtr data) {
             job.DetailedProgress = (double) current / total;
             return 0;
         });
     } else {
         throw new Exception ("Error copying track from MTP device");
     }
 }
开发者ID:fatman2021,项目名称:gnome-apps,代码行数:11,代码来源:MtpSource.cs


示例10: RenameFile

        private bool RenameFile (DatabaseTrackInfo track)
        {
            SafeUri old_uri = track.Uri;
            bool in_library = old_uri.AbsolutePath.StartsWith (musicLibrarySource.BaseDirectoryWithSeparator);

            if (!in_library) {
                return false;
            }

            string new_filename = track.PathPattern.BuildFull (musicLibrarySource.BaseDirectory, track, System.IO.Path.GetExtension (old_uri.ToString ()));
            SafeUri new_uri = new SafeUri (new_filename);

            if (!new_uri.Equals (old_uri) && !Banshee.IO.File.Exists (new_uri)) {
                Banshee.IO.File.Move (old_uri, new_uri);
                Banshee.IO.Utilities.TrimEmptyDirectories (old_uri);
                track.Uri = new_uri;
                return true;
            }

            return false;
        }
开发者ID:petejohanson,项目名称:banshee,代码行数:21,代码来源:SaveTrackMetadataJob.cs


示例11: EditStation

 private void EditStation (DatabaseTrackInfo track)
 {
     StationEditor editor = new StationEditor (track);
     editor.Response += OnStationEditorResponse;
     editor.Show ();
 }
开发者ID:gclark916,项目名称:banshee,代码行数:6,代码来源:InternetRadioSource.cs


示例12: DeleteTrack

        protected virtual bool DeleteTrack (DatabaseTrackInfo track)
        {
            if (!track.Uri.IsLocalPath)
                throw new Exception ("Cannot delete a non-local resource: " + track.Uri.Scheme);

            try {
                Banshee.IO.Utilities.DeleteFileTrimmingParentDirectories (track.Uri);
            } catch (System.IO.FileNotFoundException) {
            } catch (System.IO.DirectoryNotFoundException) {
            }

            return true;
        }
开发者ID:mono-soc-2011,项目名称:banshee,代码行数:13,代码来源:PrimarySource.cs


示例13: UpdateMetadata

 public virtual void UpdateMetadata (DatabaseTrackInfo track)
 {
 }
开发者ID:mono-soc-2011,项目名称:banshee,代码行数:3,代码来源:PrimarySource.cs


示例14: AddTrack

 protected override void AddTrack(DatabaseTrackInfo track)
 {
     AddTrack (track.TrackId);
 }
开发者ID:dufoli,项目名称:banshee,代码行数:4,代码来源:PlaylistSource.cs


示例15: DeleteTrackHook

        public override bool DeleteTrackHook (DatabaseTrackInfo track)
        {
            // Do not allow removing purchased tracks if not in the
            // Amazon Purchased Music source; this should prevent
            // accidental deletion of purchased music that may not
            // have been copied from the device yet.
            //
            // TODO: Provide some feedback when a purchased track is
            // skipped from deletion
            //
            // FIXME: unfortunately this does not work due to
            // the cache models being potentially different
            // even though they will always reference the same tracks
            // amazon_source.TrackModel.IndexOf (track) >= 0
            if (!amazon_source.Active && amazon_source.Count > 0 && track.Uri.LocalPath.StartsWith (amazon_base_dir)) {
                return false;
            }

            return true;
        }
开发者ID:haugjan,项目名称:banshee-hacks,代码行数:20,代码来源:WebOSDevice.cs


示例16: DeleteTrack

        protected override bool DeleteTrack (DatabaseTrackInfo track)
        {
            try {
                if (ms_device != null && !ms_device.DeleteTrackHook (track)) {
                    return false;
                }

                string track_file = System.IO.Path.GetFileName (track.Uri.LocalPath);
                string track_dir = System.IO.Path.GetDirectoryName (track.Uri.LocalPath);
                int files = 0;

                // Count how many files remain in the track's directory,
                // excluding self or cover art
                foreach (string file in System.IO.Directory.GetFiles (track_dir)) {
                    string relative = System.IO.Path.GetFileName (file);
                    if (relative != track_file && relative != CoverArtFileName) {
                        files++;
                    }
                }

                // If we are the last track, go ahead and delete the artwork
                // to ensure that the directory tree can get trimmed away too
                if (files == 0 && CoverArtFileName != null) {
                    System.IO.File.Delete (Paths.Combine (track_dir, CoverArtFileName));
                }

                Banshee.IO.Utilities.DeleteFileTrimmingParentDirectories (track.Uri);
            } catch (System.IO.FileNotFoundException) {
            } catch (System.IO.DirectoryNotFoundException) {
            }

            return true;
        }
开发者ID:allquixotic,项目名称:banshee-gst-sharp-work,代码行数:33,代码来源:MassStorageSource.cs


示例17: FetchForTrack

 private void FetchForTrack(DatabaseTrackInfo track)
 {
     bool save = true;
     try {
         if (String.IsNullOrEmpty (track.AlbumTitle) || String.IsNullOrEmpty (track.ArtistName)) {
             // Do not try to fetch album art for these
         } else {
             IMetadataLookupJob job = MetadataService.Instance.CreateJob (track);
             job.Run ();
         }
     } catch (System.Threading.ThreadAbortException) {
         save = false;
         throw;
     } catch (Exception e) {
         Log.Exception (e);
     } finally {
         if (save) {
             bool have_cover_art = CoverArtSpec.CoverExists (track.ArtistName, track.AlbumTitle);
             ServiceManager.DbConnection.Execute (
                 "INSERT OR REPLACE INTO CoverArtDownloads (AlbumID, Downloaded, LastAttempt) VALUES (?, ?, ?)",
                 track.AlbumId, have_cover_art, DateTime.Now);
         }
     }
 }
开发者ID:ptrimble,项目名称:banshee,代码行数:24,代码来源:CoverArtJob.cs


示例18: AddTrack

        /*public override void CopyTrackTo (DatabaseTrackInfo track, SafeUri uri, UserJob job)
        {
            Banshee.IO.File.Copy (track.Uri, uri, false);
        }*/

        protected override void AddTrack (DatabaseTrackInfo track)
        {
            // Ignore if already have it
            if (track.PrimarySourceId == DbId)
                return;

            PrimarySource source = track.PrimarySource;

            // If it's from a local primary source, change its PrimarySource
            if (source.IsLocal || source is LibrarySource) {
                track.PrimarySource = this;

                if (!(source is LibrarySource)) {
                    track.CopyToLibraryIfAppropriate (false);
                }

                track.Save (false);

                // TODO optimize, remove this?  I think it makes moving items
                // between local libraries very slow.
                //source.NotifyTracksChanged ();
            } else {
                // Figure out where we should put it if were to copy it
                var pattern = this.PathPattern ?? MusicLibrarySource.MusicFileNamePattern;
                string path = pattern.BuildFull (BaseDirectory, track);
                SafeUri uri = new SafeUri (path);

                // Make sure it's not already in the library
                // TODO optimize - no need to recreate this int [] every time
                if (DatabaseTrackInfo.ContainsUri (uri, new int [] {DbId})) {
                    return;
                }

                // Since it's not, copy it and create a new TrackInfo object
                track.PrimarySource.CopyTrackTo (track, uri, AddTrackJob);

                // Create a new entry in CoreTracks for the copied file
                DatabaseTrackInfo new_track = new DatabaseTrackInfo (track);
                new_track.Uri = uri;
                new_track.PrimarySource = this;
                new_track.Save (false);
            }
        }
开发者ID:petejohanson,项目名称:banshee,代码行数:48,代码来源:LibrarySource.cs


示例19: CopyTrackTo

 public virtual void CopyTrackTo (DatabaseTrackInfo track, SafeUri uri, BatchUserJob job)
 {
     Log.WarningFormat ("CopyTrackTo not implemented for source {0}", this);
 }
开发者ID:mono-soc-2011,项目名称:banshee,代码行数:4,代码来源:PrimarySource.cs


示例20: OnImportResult

 protected virtual void OnImportResult (DatabaseTrackInfo track, string path, Exception error)
 {
     DatabaseImportResultHandler handler = ImportResult;
     if (handler != null) {
         handler (this, new DatabaseImportResultArgs (track, path, error));
     }
 }
开发者ID:fatman2021,项目名称:gnome-apps,代码行数:7,代码来源:DatabaseImportManager.cs



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C# MediaEngine.PlayerEventArgs类代码示例发布时间:2022-05-24
下一篇:
C# Collection.TrackInfo类代码示例发布时间:2022-05-24
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap