本文整理汇总了C#中Banshee.Collection.Database.DatabaseTrackInfo类的典型用法代码示例。如果您正苦于以下问题:C# DatabaseTrackInfo类的具体用法?C# DatabaseTrackInfo怎么用?C# DatabaseTrackInfo使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
DatabaseTrackInfo类属于Banshee.Collection.Database命名空间,在下文中一共展示了DatabaseTrackInfo类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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);
}
示例2: DefaultTrackPrimarySourceChooser
protected static PrimarySource DefaultTrackPrimarySourceChooser (DatabaseTrackInfo track)
{
if ((track.MediaAttributes & TrackMediaAttributes.VideoStream) != 0) {
return ServiceManager.SourceManager.VideoLibrary;
} else {
return ServiceManager.SourceManager.MusicLibrary;
}
}
示例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;
}
}
}
示例4: Bookmark
public Bookmark(DatabaseTrackInfo track, int position_ms, string type)
{
Track = track;
Position = TimeSpan.FromMilliseconds (position_ms);
CreatedAt = DateTime.Now;
Type = type;
Save ();
}
示例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);
}
示例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);
}
示例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;
}
示例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;
}
}
示例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");
}
}
示例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;
}
示例11: EditStation
private void EditStation (DatabaseTrackInfo track)
{
StationEditor editor = new StationEditor (track);
editor.Response += OnStationEditorResponse;
editor.Show ();
}
示例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;
}
示例13: UpdateMetadata
public virtual void UpdateMetadata (DatabaseTrackInfo track)
{
}
示例14: AddTrack
protected override void AddTrack(DatabaseTrackInfo track)
{
AddTrack (track.TrackId);
}
示例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;
}