hammond-data: Add duration column to the episode table.

This commit is contained in:
Jordan Petridis
2017-12-22 17:30:07 +02:00
parent 5541b18a6a
commit 4512790f2d
7 changed files with 82 additions and 2 deletions
+2
View File
@@ -162,6 +162,7 @@ pub(crate) struct NewEpisode {
description: Option<String>,
published_date: Option<String>,
length: Option<i32>,
duration: Option<i32>,
guid: Option<String>,
epoch: i32,
podcast_id: i32,
@@ -207,6 +208,7 @@ impl NewEpisode {
if foo.title() != self.title.as_str() || foo.epoch() != self.epoch
|| foo.uri() != self.uri.as_ref().map(|s| s.as_str())
|| foo.duration() != self.duration
{
self.update(con, foo.rowid())?;
}
+30
View File
@@ -33,6 +33,7 @@ pub struct Episode {
published_date: Option<String>,
epoch: i32,
length: Option<i32>,
duration: Option<i32>,
guid: Option<String>,
played: Option<i32>,
favorite: bool,
@@ -125,6 +126,8 @@ impl Episode {
}
/// Get the `length`.
///
/// The number represents the size of the file in bytes.
pub fn length(&self) -> Option<i32> {
self.length
}
@@ -134,6 +137,18 @@ impl Episode {
self.length = value;
}
/// Get the `duration` value.
///
/// The number represents the duration of the item/episode in seconds.
pub fn duration(&self) -> Option<i32> {
self.duration
}
/// Set the `duration`.
pub fn set_duration(&mut self, value: Option<i32>) {
self.duration = value;
}
/// Epoch representation of the last time the episode was played.
///
/// None/Null for unplayed.
@@ -204,6 +219,7 @@ pub struct EpisodeWidgetQuery {
local_uri: Option<String>,
epoch: i32,
length: Option<i32>,
duration: Option<i32>,
played: Option<i32>,
// favorite: bool,
// archive: bool,
@@ -250,6 +266,8 @@ impl EpisodeWidgetQuery {
}
/// Get the `length`.
///
/// The number represents the size of the file in bytes.
pub fn length(&self) -> Option<i32> {
self.length
}
@@ -259,6 +277,18 @@ impl EpisodeWidgetQuery {
self.length = value;
}
/// Get the `duration` value.
///
/// The number represents the duration of the item/episode in seconds.
pub fn duration(&self) -> Option<i32> {
self.duration
}
/// Set the `duration`.
pub fn set_duration(&mut self, value: Option<i32>) {
self.duration = value;
}
/// Epoch representation of the last time the episode was played.
///
/// None/Null for unplayed.