Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Exp tve3.5 feat xxx add year to labels #107

Open
wants to merge 3 commits into
base: EXP-TVE3.5-MP1-MP2
Choose a base branch
from
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
193 changes: 121 additions & 72 deletions TvEngine3/Mediaportal/TV/TvPlugin/Helper/TVUtil.cs

Large diffs are not rendered by default.

58 changes: 24 additions & 34 deletions TvEngine3/Mediaportal/TV/TvPlugin/Radio/RadioRecorded.cs
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@

using System;
using System.Collections.Generic;
using System.Globalization;
using System.IO;
using System.Linq;
using System.Threading;
Expand All @@ -29,7 +28,7 @@
using MediaPortal.GUI.Library;
using MediaPortal.Player;
using MediaPortal.Profile;
using MediaPortal.Util;
using MediaPortal.Util;
using Mediaportal.TV.Server.TVControl.ServiceAgents;
using Mediaportal.TV.Server.TVDatabase.Entities;
using Mediaportal.TV.Server.TVDatabase.Entities.Enums;
Expand All @@ -38,7 +37,7 @@
using Mediaportal.TV.TvPlugin.Helper;
using Action = MediaPortal.GUI.Library.Action;
using Log = Mediaportal.TV.Server.TVLibrary.Interfaces.Logging.Log;


namespace Mediaportal.TV.TvPlugin.Radio
{
Expand Down Expand Up @@ -113,7 +112,7 @@ protected override void LoadSettings()
{
currentLayout = (GUIFacadeControl.Layout)xmlreader.GetValueAsInt(SerializeName, "layout", (int)GUIFacadeControl.Layout.List);
m_bSortAscending = xmlreader.GetValueAsBool(SerializeName, "sortasc", true);

string strTmp = xmlreader.GetValueAsString("radiorecorded", "sort", "channel");

if (strTmp == "channel")
Expand Down Expand Up @@ -152,7 +151,7 @@ protected override void SaveSettings()
{
xmlwriter.SetValue(SerializeName, "layout", (int)currentLayout);
xmlwriter.SetValueAsBool(SerializeName, "sortasc", m_bSortAscending);

switch (_currentSortMethod)
{
case SortMethod.Channel:
Expand Down Expand Up @@ -532,7 +531,7 @@ protected override void UpdateButtonStates()
this.LogError(ex, "RadioRecorded: Error updating button states");
}
}

#endregion

#region Public methods
Expand Down Expand Up @@ -612,7 +611,7 @@ private void LoadDirectory()
{
// catch exceptions here so MP will go on and list further recs
try
{
{
bool add = true;

// combine recordings with the same name to a folder located on top
Expand Down Expand Up @@ -819,7 +818,7 @@ private GUIListItem BuildItemFromRecording(Recording aRecording)
if (refCh != null)
{
strChannelName = refCh.DisplayName;
}
}

// this.LogDebug("RadioRecorded: BuildItemFromRecording [{0}]: {1} ({2}) on channel {3}", _currentDbView.ToString(), aRecording.title, aRecording.ProgramCategory.category, strChannelName);
item = new GUIListItem();
Expand Down Expand Up @@ -849,18 +848,18 @@ private GUIListItem BuildItemFromRecording(Recording aRecording)

// Get the channel logo for the small icons
string StationLogo = Utils.GetCoverArt(Thumbs.Radio, strChannelName);
if (!string.IsNullOrEmpty(StationLogo))
if (!string.IsNullOrEmpty(StationLogo))
{
SmallThumb = StationLogo;
}

item.IconImage = item.ThumbnailImage = item.IconImageBig = SmallThumb;
// Display previews only if the option to create them is active
if (string.IsNullOrEmpty(PreviewThumb))
if (string.IsNullOrEmpty(PreviewThumb))
{
item.ThumbnailImage = String.Empty;
}

//Mark the recording with a "rec. symbol" if it is an active recording.
if (IsRecordingActual(aRecording))
{
Expand Down Expand Up @@ -891,16 +890,11 @@ private void SetLabels()
continue;
}
Recording rec = (Recording)item1.TVTag;
TimeSpan ts = rec.EndTime - rec.StartTime;

string strTime = String.Format("{0} ({1})",
Utils.GetNamedDate(rec.StartTime),
Utils.SecondsToHMString((int)ts.TotalSeconds));

// Do not display a duration in top level of History view
if (_currentDbView != DBView.History || _currentLabel != String.Empty)
{
item1.Label2 = strTime;
item1.Label2 = TVUtil.GetRecordingDateString(rec);
}
if (currentLayout != GUIFacadeControl.Layout.List)
{
Expand Down Expand Up @@ -973,7 +967,7 @@ private bool OnSelectedRecording(int iItem)
GUIPropertyManager.SetProperty("#Play.Current.ArtistThumb", pItem.Label);
GUIPropertyManager.SetProperty("#Play.Current.Album", pItem.Label);
GUIPropertyManager.SetProperty("#Play.Current.Thumb", pItem.ThumbnailImage);

Recording rec = (Recording)pItem.TVTag;
IEnumerable<Recording> itemlist = ServiceAgents.Instance.RecordingServiceAgent.ListAllRecordingsByMediaType(MediaTypeEnum.Radio);

Expand Down Expand Up @@ -1049,7 +1043,7 @@ private void OnDeleteRecording(int iItem)
}

dlgYesNo.SetDefaultToYes(false);
bool isRec = IsRecordingActual(rec);
bool isRec = IsRecordingActual(rec);
bool remove = false;
if (isRec)
{
Expand Down Expand Up @@ -1111,7 +1105,7 @@ private void DeleteRecordingAndUpdateGUI(Recording rec)


private void TryDeleteRecordingAndNotifyUser(Recording rec)
{
{
int timeout = 0;
bool deleteRecording = false;

Expand Down Expand Up @@ -1263,22 +1257,18 @@ private void SetProperties(Recording rec)
GUIPropertyManager.SetProperty("#Radio.Recorded.thumb", "");
return;
}
string strTime = string.Format("{0} {1} - {2}",
Utils.GetShortDayString(rec.StartTime),
rec.StartTime.ToString("t", CultureInfo.CurrentCulture.DateTimeFormat),
rec.EndTime.ToString("t", CultureInfo.CurrentCulture.DateTimeFormat));

GUIPropertyManager.SetProperty("#Radio.Recorded.Title", rec.Title);
GUIPropertyManager.SetProperty("#Radio.Recorded.Genre", TVUtil.GetCategory(rec.ProgramCategory));
GUIPropertyManager.SetProperty("#Radio.Recorded.Time", strTime);
GUIPropertyManager.SetProperty("#Radio.Recorded.Time", TVUtil.GetRecordingDateStringFull(rec));
GUIPropertyManager.SetProperty("#Radio.Recorded.Description", rec.Description);

string strLogo = "";

GUIPropertyManager.SetProperty("#Radio.Recorded.Channel", GetRecordingDisplayName(rec));
strLogo = Utils.GetCoverArt(Thumbs.Radio, GetRecordingDisplayName(rec));

if (!string.IsNullOrEmpty(strLogo))
if (!string.IsNullOrEmpty(strLogo))
{
GUIPropertyManager.SetProperty("#Radio.Recorded.thumb", strLogo);
}
Expand Down Expand Up @@ -1585,7 +1575,7 @@ private void doOnPlayBackStoppedOrChanged(g_Player.MediaType type, int stoptime,
{
return;
}

Recording rec = ServiceAgents.Instance.RecordingServiceAgent.GetRecordingByFileName(filename);
if (rec != null)
{
Expand All @@ -1595,7 +1585,7 @@ private void doOnPlayBackStoppedOrChanged(g_Player.MediaType type, int stoptime,
}
; //temporary workaround before end of stream get's properly implemented
rec = ServiceAgents.Instance.RecordingServiceAgent.GetRecording(rec.IdRecording);
rec.StopTime = stoptime;
rec.StopTime = stoptime;
ServiceAgents.Instance.RecordingServiceAgent.SaveRecording(rec);
}
else
Expand Down Expand Up @@ -1631,22 +1621,22 @@ private void OnPlayRecordingBackEnded(g_Player.MediaType type, string filename)
}

g_Player.Stop();

Recording rec = ServiceAgents.Instance.RecordingServiceAgent.GetRecordingByFileName(filename);
if (rec != null)
{
if (_deleteWatchedShows || rec.KeepUntil == (int)KeepMethodType.UntilWatched)
{

ServiceAgents.Instance.ControllerServiceAgent.DeleteRecording(rec.IdRecording);
}
else
{
rec = ServiceAgents.Instance.RecordingServiceAgent.GetRecording(rec.IdRecording);
rec.StopTime = 0;
rec.StopTime = 0;
ServiceAgents.Instance.RecordingServiceAgent.SaveRecording(rec);
}
}
}
}

private void OnPlayRecordingBackStarted(g_Player.MediaType type, string filename)
Expand All @@ -1673,10 +1663,10 @@ private void OnPlayRecordingBackStarted(g_Player.MediaType type, string filename
private void ResetWatchedStatus(Recording aRecording)
{
aRecording.TimesWatched = 0;
aRecording.StopTime = 0;
aRecording.StopTime = 0;
ServiceAgents.Instance.RecordingServiceAgent.SaveRecording(aRecording);
}

#endregion
}
}
}
Loading