Skip to content

Commit

Permalink
Recording Metadata: Allow editing season, episode, and inetref from t…
Browse files Browse the repository at this point in the history
…he PBB.

You can now edit the season, episode, and inetref of a recording in the Watch Recordings screen:

MENU->Recording Options->Change Recording Metadata

Really, though, this should ONLY be done when a run of "mythmetadatalookup" without arguments doesn't set the inetref, season, or episode properly.  This should be under 10% of the time, well under 10% of the time if you've set up the inetrefs in your recording rules.

Much as I am loath to do it, this adds new required fields to the editmetadata window in the PBB.  As ever, you can get the most up-to-date version of Arclight for the theme I've made these changes on (as opposed to adding them to other themes as an afterthought):

http://www.fecitfacta.com/Arclight.tar.gz
  • Loading branch information
Robert McNamara committed Jul 9, 2011
1 parent 6edebe3 commit c704430
Show file tree
Hide file tree
Showing 6 changed files with 178 additions and 37 deletions.
4 changes: 2 additions & 2 deletions mythtv/libs/libmyth/rssparse.h
Expand Up @@ -19,9 +19,9 @@ using namespace std;
typedef QHash<QString,QString> MetadataMap;

typedef enum ArticleTypes {
VIDEO = 0,
VIDEO_FILE = 0,
VIDEO_PODCAST = 1,
AUDIO = 2,
AUDIO_FILE = 2,
AUDIO_PODCAST = 3
} ArticleType;

Expand Down
51 changes: 44 additions & 7 deletions mythtv/programs/mythfrontend/playbackbox.cpp
Expand Up @@ -17,6 +17,7 @@
#include "mythuistatetype.h"
#include "mythuicheckbox.h"
#include "mythuitextedit.h"
#include "mythuispinbox.h"
#include "mythdialogbox.h"
#include "recordinginfo.h"
#include "mythuihelper.h"
Expand All @@ -30,6 +31,7 @@
#include "remoteutil.h"
#include "mythdbcon.h"
#include "playgroup.h"
#include "netutils.h"
#include "mythdirs.h"
#include "mythdb.h"
#include "util.h"
Expand Down Expand Up @@ -4653,8 +4655,9 @@ void PlaybackBox::showMetadataEditor()
if (editMetadata->Create())
{
connect(editMetadata, SIGNAL(result(const QString &, const QString &,
const QString &)), SLOT(saveRecMetadata(const QString &,
const QString &, const QString &)));
const QString &, const QString &, uint, uint)), SLOT(
saveRecMetadata(const QString &, const QString &,
const QString &, const QString &, uint, uint)));
mainStack->AddScreen(editMetadata);
}
else
Expand All @@ -4663,7 +4666,10 @@ void PlaybackBox::showMetadataEditor()

void PlaybackBox::saveRecMetadata(const QString &newTitle,
const QString &newSubtitle,
const QString &newDescription)
const QString &newDescription,
const QString &newInetref,
uint newSeason,
uint newEpisode)
{
MythUIButtonListItem *item = m_recordingList->GetItemCurrent();

Expand All @@ -4688,14 +4694,28 @@ void PlaybackBox::saveRecMetadata(const QString &newTitle,
if (!newSubtitle.trimmed().isEmpty())
tempSubTitle = QString("%1 - \"%2\"")
.arg(tempSubTitle).arg(newSubtitle);
QString seasone = QString("s%1e%2").arg(GetDisplaySeasonEpisode
(newSeason, 2))
.arg(GetDisplaySeasonEpisode(newEpisode, 2));
QString seasonx = QString("%1x%2").arg(GetDisplaySeasonEpisode
(newSeason, 1))
.arg(GetDisplaySeasonEpisode(newEpisode, 2));

item->SetText(tempSubTitle, "titlesubtitle");
item->SetText(newTitle, "title");
item->SetText(newSubtitle, "subtitle");
item->SetText(newInetref, "inetref");
item->SetText(QString::number(newSeason), "season");
item->SetText(QString::number(newEpisode), "episode");
item->SetText(seasonx, "00x00");
item->SetText(seasone, "s00e00");
if (newDescription != NULL)
item->SetText(newDescription, "description");
}

pginfo->SaveInetRef(newInetref);
pginfo->SaveSeasonEpisode(newSeason, newEpisode);

RecordingInfo ri(*pginfo);
ri.ApplyRecordRecTitleChange(newTitle, newSubtitle, newDescription);
*pginfo = ri;
Expand Down Expand Up @@ -5077,7 +5097,8 @@ RecMetadataEdit::RecMetadataEdit(MythScreenStack *lparent, ProgramInfo *pginfo)
: MythScreenType(lparent, "recmetadataedit"),
m_progInfo(pginfo)
{
m_titleEdit = m_subtitleEdit = m_descriptionEdit = NULL;
m_titleEdit = m_subtitleEdit = m_descriptionEdit = m_inetrefEdit = NULL;
m_seasonSpin = m_episodeSpin = NULL;
}

bool RecMetadataEdit::Create()
Expand All @@ -5088,9 +5109,13 @@ bool RecMetadataEdit::Create()
m_titleEdit = dynamic_cast<MythUITextEdit*>(GetChild("title"));
m_subtitleEdit = dynamic_cast<MythUITextEdit*>(GetChild("subtitle"));
m_descriptionEdit = dynamic_cast<MythUITextEdit*>(GetChild("description"));
m_inetrefEdit = dynamic_cast<MythUITextEdit*>(GetChild("inetref"));
m_seasonSpin = dynamic_cast<MythUISpinBox*>(GetChild("season"));
m_episodeSpin = dynamic_cast<MythUISpinBox*>(GetChild("episode"));
MythUIButton *okButton = dynamic_cast<MythUIButton*>(GetChild("ok"));

if (!m_titleEdit || !m_subtitleEdit || !okButton)
if (!m_titleEdit || !m_subtitleEdit || !m_inetrefEdit || !m_seasonSpin ||
!m_episodeSpin || !okButton)
{
LOG(VB_GENERAL, LOG_ERR, LOC +
"Window 'editmetadata' is missing required elements.");
Expand All @@ -5106,6 +5131,12 @@ bool RecMetadataEdit::Create()
m_descriptionEdit->SetText(m_progInfo->GetDescription());
m_descriptionEdit->SetMaxLength(255);
}
m_inetrefEdit->SetText(m_progInfo->GetInetRef());
m_inetrefEdit->SetMaxLength(255);
m_seasonSpin->SetRange(0,100,1,1);
m_seasonSpin->SetValue(m_progInfo->GetSeason());
m_episodeSpin->SetRange(0,999,1,1);
m_episodeSpin->SetValue(m_progInfo->GetEpisode());

connect(okButton, SIGNAL(Clicked()), SLOT(SaveChanges()));

Expand All @@ -5119,13 +5150,19 @@ void RecMetadataEdit::SaveChanges()
QString newRecTitle = m_titleEdit->GetText();
QString newRecSubtitle = m_subtitleEdit->GetText();
QString newRecDescription = NULL;
QString newRecInetref = NULL;
uint newRecSeason = 0, newRecEpisode = 0;
if (m_descriptionEdit)
newRecDescription = m_descriptionEdit->GetText();
newRecDescription = m_descriptionEdit->GetText();
newRecInetref = m_inetrefEdit->GetText();
newRecSeason = m_seasonSpin->GetIntValue();
newRecEpisode = m_episodeSpin->GetIntValue();

if (newRecTitle.isEmpty())
return;

emit result(newRecTitle, newRecSubtitle, newRecDescription);
emit result(newRecTitle, newRecSubtitle, newRecDescription,
newRecInetref, newRecSeason, newRecEpisode);
Close();
}

Expand Down
9 changes: 7 additions & 2 deletions mythtv/programs/mythfrontend/playbackbox.h
Expand Up @@ -211,7 +211,8 @@ class PlaybackBox : public ScheduleCommon
void setPlayGroup(QString newPlayGroup);

void saveRecMetadata(const QString &newTitle, const QString &newSubtitle,
const QString &newDescription);
const QString &newDescription, const QString &newInetref,
uint season, uint episode);

void SetRecGroupPassword(const QString &newPasswd);

Expand Down Expand Up @@ -525,7 +526,8 @@ class RecMetadataEdit : public MythScreenType
bool Create(void);

signals:
void result(const QString &, const QString &, const QString &);
void result(const QString &, const QString &, const QString &,
const QString &, uint, uint);

protected slots:
void SaveChanges(void);
Expand All @@ -534,6 +536,9 @@ class RecMetadataEdit : public MythScreenType
MythUITextEdit *m_titleEdit;
MythUITextEdit *m_subtitleEdit;
MythUITextEdit *m_descriptionEdit;
MythUITextEdit *m_inetrefEdit;
MythUISpinBox *m_seasonSpin;
MythUISpinBox *m_episodeSpin;

ProgramInfo *m_progInfo;
};
Expand Down
49 changes: 41 additions & 8 deletions mythtv/themes/MythCenter-wide/recordings-ui.xml
Expand Up @@ -829,30 +829,63 @@
</textarea>

<textarea name="titlelabel" from="basetextarea">
<area>58,80,300,30</area>
<area>8,120,90,30</area>
<align>right,vcenter</align>
<value>Title:</value>
</textarea>

<textedit name="title" from="basetextedit">
<position>58,110</position>
<position>105,110</position>
</textedit>

<textarea name="subtitlelabel" from="basetextarea">
<area>58,170,300,30</area>
<area>8,180,90,30</area>
<align>right,vcenter</align>
<value>Subtitle:</value>
</textarea>

<textedit name="subtitle" from="basetextedit">
<position>58,200</position>
<position>105,170</position>
</textedit>

<textarea name="inetreflabel" from="basetextarea">
<area>8,240,90,30</area>
<align>right,vcenter</align>
<value>Inetref:</value>
</textarea>

<textedit name="inetref" from="basetextedit">
<position>105,230</position>
</textedit>

<textarea name="seaslabel" from="basetextarea">
<area>8,300,90,30</area>
<align>right,vcenter</align>
<value>Season:</value>
</textarea>

<spinbox name="season" from="basespinbox">
<position>105,290</position>
</spinbox>

<textarea name="eplabel" from="basetextarea">
<area>208,300,90,30</area>
<align>right,vcenter</align>
<value>Episode:</value>
</textarea>

<spinbox name="episode" from="basespinbox">
<position>305,290</position>
</spinbox>

<textarea name="descriptionlabel" from="basetextarea">
<area>58,260,300,30</area>
<value>Description:</value>
<area>8,360,90,30</area>
<align>right,vcenter</align>
<value>Plot:</value>
</textarea>

<textedit name="description" from="basemultilinetextedit">
<position>58,290</position>
<textedit name="description" from="basetextedit">
<position>105,350</position>
</textedit>

<button name="ok" from="basebutton">
Expand Down
51 changes: 42 additions & 9 deletions mythtv/themes/MythCenter/recordings-ui.xml
Expand Up @@ -445,34 +445,67 @@
</textarea>

<textarea name="titlelabel" from="basetextarea">
<area>58,80,300,30</area>
<area>8,120,90,30</area>
<align>right,vcenter</align>
<value>Title:</value>
</textarea>

<textedit name="title" from="basetextedit">
<position>58,110</position>
<position>105,110</position>
</textedit>

<textarea name="subtitlelabel" from="basetextarea">
<area>58,170,300,30</area>
<area>8,180,90,30</area>
<align>right,vcenter</align>
<value>Subtitle:</value>
</textarea>

<textedit name="subtitle" from="basetextedit">
<position>58,200</position>
<position>105,170</position>
</textedit>

<textarea name="inetreflabel" from="basetextarea">
<area>8,240,90,30</area>
<align>right,vcenter</align>
<value>Inetref:</value>
</textarea>

<textedit name="inetref" from="basetextedit">
<position>105,230</position>
</textedit>

<textarea name="seaslabel" from="basetextarea">
<area>8,300,90,30</area>
<align>right,vcenter</align>
<value>Season:</value>
</textarea>

<spinbox name="season" from="basespinbox">
<position>105,290</position>
</spinbox>

<textarea name="eplabel" from="basetextarea">
<area>208,300,90,30</area>
<align>right,vcenter</align>
<value>Episode:</value>
</textarea>

<spinbox name="episode" from="basespinbox">
<position>305,290</position>
</spinbox>

<textarea name="descriptionlabel" from="basetextarea">
<area>58,260,300,30</area>
<value>Description:</value>
<area>8,360,90,30</area>
<align>right,vcenter</align>
<value>Plot:</value>
</textarea>

<textedit name="description" from="basemultilinetextedit">
<position>58,290</position>
<textedit name="description" from="basetextedit">
<position>105,350</position>
</textedit>

<button name="ok" from="basebutton">
<position>175,435</position>
<position>175,434</position>
<value>OK</value>
</button>
</window>
Expand Down
51 changes: 42 additions & 9 deletions mythtv/themes/default/recordings-ui.xml
Expand Up @@ -416,34 +416,67 @@
</textarea>

<textarea name="titlelabel" from="basetextarea">
<area>58,80,300,30</area>
<area>8,120,90,30</area>
<align>right,vcenter</align>
<value>Title:</value>
</textarea>

<textedit name="title" from="basetextedit">
<position>58,110</position>
<position>105,110</position>
</textedit>

<textarea name="subtitlelabel" from="basetextarea">
<area>58,170,300,30</area>
<area>8,180,90,30</area>
<align>right,vcenter</align>
<value>Subtitle:</value>
</textarea>

<textedit name="subtitle" from="basetextedit">
<position>58,200</position>
<position>105,170</position>
</textedit>

<textarea name="inetreflabel" from="basetextarea">
<area>8,240,90,30</area>
<align>right,vcenter</align>
<value>Inetref:</value>
</textarea>

<textedit name="inetref" from="basetextedit">
<position>105,230</position>
</textedit>

<textarea name="seaslabel" from="basetextarea">
<area>8,300,90,30</area>
<align>right,vcenter</align>
<value>Season:</value>
</textarea>

<spinbox name="season" from="basespinbox">
<position>105,290</position>
</spinbox>

<textarea name="eplabel" from="basetextarea">
<area>208,300,90,30</area>
<align>right,vcenter</align>
<value>Episode:</value>
</textarea>

<spinbox name="episode" from="basespinbox">
<position>305,290</position>
</spinbox>

<textarea name="descriptionlabel" from="basetextarea">
<area>58,260,300,30</area>
<value>Description:</value>
<area>8,360,90,30</area>
<align>right,vcenter</align>
<value>Plot:</value>
</textarea>

<textedit name="description" from="basemultilinetextarea">
<position>58,290</position>
<textedit name="description" from="basetextedit">
<position>105,350</position>
</textedit>

<button name="ok" from="basebutton">
<position>175,435</position>
<position>175,434</position>
<value>OK</value>
</button>
</window>
Expand Down

0 comments on commit c704430

Please sign in to comment.