Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
61 changes: 18 additions & 43 deletions src/BuildCast/DataModel/Episode.cs
Original file line number Diff line number Diff line change
Expand Up @@ -15,22 +15,13 @@
using System.Threading.Tasks;
using BuildCast.Helpers;
using Windows.Foundation.Collections;
using System.Diagnostics;

namespace BuildCast.DataModel
{
public class Episode
{
private string _uri;
private string _localFilename;
private string _title;
private string _description;
private string _subtitle;
private string _itemThumbnail;
private Feed _feed;
private DateTimeOffset _publishDate;
private string _formattedPublishDate;
private TimeSpan _duration;

/// <summary>
/// Initializes a new instance of the <see cref="Episode"/> class.
Expand All @@ -54,12 +45,12 @@ public Episode(
this.Id = Guid.NewGuid();
this.Key = key;
this.LocalFileName = BackgroundDownloadHelper.SafeHashUri(new Uri(this.Key));
this._title = title;
this._description = description;
this._itemThumbnail = itemThumbnail;
this.Title = title;
this.Description = description;
this.ItemThumbnail = itemThumbnail;

this._publishDate = publishDate;
this._duration = duration;
this.PublishDate = publishDate;
this.Duration = duration;
this.Subtitle = subtitle;

if (feed != null)
Expand Down Expand Up @@ -89,10 +80,7 @@ public Episode(string key, string title, string description, string itemThumbnai

public string Key
{
get
{
return _uri;
}
get => _uri;

set
{
Expand All @@ -106,52 +94,39 @@ public string Key
}
}

public string LocalFileName { get => _localFilename; set => _localFilename = value; }
public string LocalFileName { get; set; }

public string Title { get => _title; set => _title = value; }
public string Title { get; set; }

public string Description { get => _description; set => _description = value; }
public string Description { get; set; }

public string ItemThumbnail { get => _itemThumbnail; set => _itemThumbnail = value; }
public string ItemThumbnail { get; set; }

public bool IsDownloaded { get; set; }

public string FeedId
{
get; set;
}
public string FeedId { get; set; }

[System.ComponentModel.DataAnnotations.Schema.NotMapped]
public Feed Feed
{
get
{
if (_feed == null)
{
_feed = GetFeed();
}

return _feed;
}

get => _feed ?? GetFeed();
set => _feed = value;
}

public DateTimeOffset PublishDate { get => _publishDate; set => _publishDate = value; }
public string FormatPublishDate (Episode e)
public DateTimeOffset PublishDate { get; set; }

public string FormatPublishDate(Episode e)
{
string formattedDate = e.PublishDate.Month.ToString() + "/" + e.PublishDate.Day.ToString() + "/" + e.PublishDate.Year.ToString();
return formattedDate;
}

public TimeSpan Duration { get => _duration; set => _duration = value; }

public string Subtitle { get => _subtitle; set => _subtitle = value; }
public TimeSpan Duration { get; set; }
public string Subtitle { get; set; }

public override string ToString()
{
return _title ?? string.Empty;
return Title ?? string.Empty;
}

public async Task SetDownloaded()
Expand Down
1 change: 1 addition & 0 deletions src/BuildCast/Views/Player.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -148,6 +148,7 @@
Background="{ThemeResource AppBarBackgroundThemeBrush}"
BorderThickness="0,0,0,0"
CloseButtonText="Cancel"
DefaultButton="Primary"
PrimaryButtonCommand="{x:Bind AddBookmarkCommand}"
PrimaryButtonText="Add bookmark">
<ContentDialog.Content>
Expand Down