Skip to content

Commit

Permalink
fixes #130
Browse files Browse the repository at this point in the history
the generic hostname was renamed to master_hostname, so as to be a key
to load all program data (recorded, upcoming, guide) for a master
backend, the original hostname has now be left as is as returned by the
myth services api calls for program lists, this issue needs further
testing, especially with mythtv slave backends
  • Loading branch information
Daniel Frey committed Mar 13, 2013
1 parent c60573a commit 238064a
Show file tree
Hide file tree
Showing 20 changed files with 112 additions and 92 deletions.
8 changes: 8 additions & 0 deletions src/org/mythtv/client/ui/MainMenuFragment.java
Original file line number Diff line number Diff line change
Expand Up @@ -309,6 +309,14 @@ public void onResume() {

//get connected location profile
LocationProfile profile = this.mLocationProfileDaoHelper.findConnectedProfile(this.getActivity());
if( null == profile ) {
List<LocationProfile> profiles = mLocationProfileDaoHelper.findAll( getActivity() );
if( profiles.size() == 1 ) {
profile = profiles.get( 0 );

mLocationProfileDaoHelper.setConnectedLocationProfile( getActivity(), profile.getId() );
}
}

//get away/home toggle
ToggleButton toggleIsAway = (ToggleButton)this.getActivity().findViewById(R.id.toggleButtonIsAway);
Expand Down
2 changes: 1 addition & 1 deletion src/org/mythtv/client/ui/dvr/ProgramGroupFragment.java
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ public Loader<Cursor> onCreateLoader( int id, Bundle args ) {
LocationProfile locationProfile = mLocationProfileDaoHelper.findConnectedProfile( getActivity() );

String[] projection = { ProgramConstants._ID, ProgramConstants.FIELD_TITLE, ProgramConstants.FIELD_SUB_TITLE, ProgramConstants.FIELD_CATEGORY, ProgramConstants.FIELD_START_TIME };
String selection = ProgramConstants.FIELD_TITLE + " = ? AND " + ProgramConstants.TABLE_NAME_RECORDED + "." + ProgramConstants.FIELD_HOSTNAME + " = ? AND " + ProgramConstants.TABLE_NAME_RECORDED + "." + ProgramConstants.FIELD_IN_ERROR + " = ?";
String selection = ProgramConstants.FIELD_TITLE + " = ? AND " + ProgramConstants.TABLE_NAME_RECORDED + "." + ProgramConstants.FIELD_MASTER_HOSTNAME + " = ? AND " + ProgramConstants.TABLE_NAME_RECORDED + "." + ProgramConstants.FIELD_IN_ERROR + " = ?";
String[] selectionArgs = { ( null != programGroup && null != programGroup.getTitle() ? programGroup.getTitle() : "" ), locationProfile.getHostname(), "0" };

CursorLoader cursorLoader = new CursorLoader( getActivity(), ProgramConstants.CONTENT_URI_RECORDED, projection, selection, selectionArgs, ProgramConstants.FIELD_SEASON + " DESC ," + ProgramConstants.FIELD_EPISODE + " DESC" );
Expand Down
4 changes: 2 additions & 2 deletions src/org/mythtv/client/ui/dvr/RecordingsFragment.java
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ public Loader<Cursor> onCreateLoader( int id, Bundle args ) {
Log.v( TAG, "onCreateLoader : enter" );

String[] projection = null;
String selection = ProgramGroupConstants.FIELD_HOSTNAME + " = ?";
String selection = ProgramGroupConstants.FIELD_MASTER_HOSTNAME + " = ?";
String[] selectionArgs = new String[] { mLocationProfile.getHostname() };
String sortOrder = ProgramGroupConstants.FIELD_PROGRAM_GROUP;

Expand Down Expand Up @@ -420,7 +420,7 @@ public void onReceive( Context context, Intent intent ) {
LocationProfile profile = mLocationProfileDaoHelper.findConnectedProfile( getActivity() );

boolean inError = false;
Cursor errorCursor = getActivity().getContentResolver().query( ProgramConstants.CONTENT_URI_RECORDED, new String[] { ProgramConstants._ID }, ProgramConstants.TABLE_NAME_RECORDED + "." + ProgramConstants.FIELD_IN_ERROR + " = ? AND " + ProgramConstants.TABLE_NAME_RECORDED + "." + ProgramConstants.FIELD_HOSTNAME + " = ?", new String[] { "1", profile.getHostname() }, null );
Cursor errorCursor = getActivity().getContentResolver().query( ProgramConstants.CONTENT_URI_RECORDED, new String[] { ProgramConstants._ID }, ProgramConstants.TABLE_NAME_RECORDED + "." + ProgramConstants.FIELD_IN_ERROR + " = ? AND " + ProgramConstants.TABLE_NAME_RECORDED + "." + ProgramConstants.FIELD_MASTER_HOSTNAME + " = ?", new String[] { "1", profile.getHostname() }, null );
if( errorCursor.moveToFirst() ) {
inError = true;
}
Expand Down
2 changes: 1 addition & 1 deletion src/org/mythtv/client/ui/dvr/UpcomingFragment.java
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ public Loader<Cursor> onCreateLoader( int id, Bundle args ) {
String selection = ProgramConstants.TABLE_NAME_UPCOMING + "." + ProgramConstants.FIELD_START_TIME + " >= ? AND " +
ProgramConstants.TABLE_NAME_UPCOMING + "." + ProgramConstants.FIELD_START_TIME + " < ? AND " +
ProgramConstants.TABLE_NAME_UPCOMING + "." + ProgramConstants.FIELD_START_TIME + " >= ? AND " +
ProgramConstants.TABLE_NAME_UPCOMING + "." + ProgramConstants.FIELD_HOSTNAME + " = ?";
ProgramConstants.TABLE_NAME_UPCOMING + "." + ProgramConstants.FIELD_MASTER_HOSTNAME + " = ?";

String[] selectionArgs = new String[] { String.valueOf( startDay.getMillis() ), String.valueOf( endDay.getMillis() ), String.valueOf( now.getMillis() ), locationProfile.getHostname() };

Expand Down
4 changes: 2 additions & 2 deletions src/org/mythtv/db/AbstractBaseConstants.java
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ public abstract class AbstractBaseConstants implements BaseColumns {
public static final String FIELD_ID_DATA_TYPE = "INTEGER";
public static final String FIELD_ID_PRIMARY_KEY = "PRIMARY KEY AUTOINCREMENT";

public static final String FIELD_HOSTNAME = "HOSTNAME";
public static final String FIELD_HOSTNAME_DATA_TYPE = "TEXT";
public static final String FIELD_MASTER_HOSTNAME = "MASTER_HOSTNAME";
public static final String FIELD_MASTER_HOSTNAME_DATA_TYPE = "TEXT";

}
2 changes: 1 addition & 1 deletion src/org/mythtv/db/AbstractDaoHelper.java
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ protected AbstractDaoHelper() { }

protected String appendLocationHostname( final Context context, final LocationProfile locationProfile, String selection, String table ) {

return ( !TextUtils.isEmpty( table ) ? ( table + "." ) : "" ) + AbstractBaseConstants.FIELD_HOSTNAME
return ( !TextUtils.isEmpty( table ) ? ( table + "." ) : "" ) + AbstractBaseConstants.FIELD_MASTER_HOSTNAME
+ " = '"
+ locationProfile.getHostname()
+ "'"
Expand Down
25 changes: 13 additions & 12 deletions src/org/mythtv/db/DatabaseHelper.java
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ public class DatabaseHelper extends SQLiteOpenHelper {
private static final String TAG = DatabaseHelper.class.getSimpleName();

private static final String DATABASE_NAME = "mythtvdb";
private static final int DATABASE_VERSION = 106;
private static final int DATABASE_VERSION = 107;

public DatabaseHelper( Context context ) {
super( context, DATABASE_NAME, null, DATABASE_VERSION );
Expand Down Expand Up @@ -110,8 +110,8 @@ public void onCreate( SQLiteDatabase db ) {
public void onUpgrade( SQLiteDatabase db, int oldVersion, int newVersion ) {
Log.v( TAG, "onUpgrade : enter" );

if( oldVersion < 106 ) {
Log.v( TAG, "onUpgrade : upgrading to db version 106" );
if( oldVersion < 107 ) {
Log.v( TAG, "onUpgrade : upgrading to db version 107" );

onCreate( db );

Expand Down Expand Up @@ -204,7 +204,7 @@ private void createEtag( SQLiteDatabase db ) {
sqlBuilder.append( EtagConstants.FIELD_VALUE ).append( " " ).append( EtagConstants.FIELD_VALUE_DATA_TYPE ).append( ", " );
sqlBuilder.append( EtagConstants.FIELD_DATA_ID ).append( " " ).append( EtagConstants.FIELD_DATA_ID_DATA_TYPE ).append( " default" ).append( EtagConstants.FIELD_DATA_ID_DEFAULT ).append( ", " );
sqlBuilder.append( EtagConstants.FIELD_DATE ).append( " " ).append( EtagConstants.FIELD_DATE_DATA_TYPE ).append( ", " );
sqlBuilder.append( EtagConstants.FIELD_HOSTNAME ).append( " " ).append( EtagConstants.FIELD_HOSTNAME_DATA_TYPE );
sqlBuilder.append( EtagConstants.FIELD_MASTER_HOSTNAME ).append( " " ).append( EtagConstants.FIELD_MASTER_HOSTNAME_DATA_TYPE );
sqlBuilder.append( ");" );
String sql = sqlBuilder.toString();
if( Log.isLoggable( TAG, Log.VERBOSE ) ) {
Expand Down Expand Up @@ -489,7 +489,8 @@ private void createProgram( SQLiteDatabase db, String tableName ) {
sqlBuilder.append( ProgramConstants.FIELD_EPISODE ).append( " " ).append( ProgramConstants.FIELD_EPISODE_DATA_TYPE ).append( ", " );
sqlBuilder.append( ProgramConstants.FIELD_CHANNEL_ID ).append( " " ).append( ProgramConstants.FIELD_CHANNEL_ID_DATA_TYPE ).append( ", " );
sqlBuilder.append( ProgramConstants.FIELD_RECORD_ID ).append( " " ).append( ProgramConstants.FIELD_RECORD_ID_DATA_TYPE ).append( ", " );
sqlBuilder.append( ProgramConstants.FIELD_IN_ERROR ).append( " " ).append( ProgramConstants.FIELD_IN_ERROR_DATA_TYPE );
sqlBuilder.append( ProgramConstants.FIELD_IN_ERROR ).append( " " ).append( ProgramConstants.FIELD_IN_ERROR_DATA_TYPE ).append( ", " );
sqlBuilder.append( ProgramConstants.FIELD_MASTER_HOSTNAME ).append( " " ).append( ProgramConstants.FIELD_MASTER_HOSTNAME_DATA_TYPE );
sqlBuilder.append( ");" );
String sql = sqlBuilder.toString();
if( Log.isLoggable( TAG, Log.VERBOSE ) ) {
Expand Down Expand Up @@ -542,8 +543,8 @@ private void createChannel( SQLiteDatabase db ) {
sqlBuilder.append( ChannelConstants.FIELD_VISIBLE ).append( " " ).append( ChannelConstants.FIELD_VISIBLE_DATA_TYPE ).append( " default " ).append( ChannelConstants.FIELD_VISIBLE_DEFAULT ).append( ", " );
sqlBuilder.append( ChannelConstants.FIELD_XMLTV_ID ).append( " " ).append( ChannelConstants.FIELD_XMLTV_ID_DATA_TYPE ).append( ", " );
sqlBuilder.append( ChannelConstants.FIELD_DEFAULT_AUTH ).append( " " ).append( ChannelConstants.FIELD_DEFAULT_AUTH_DATA_TYPE ).append( ", " );
sqlBuilder.append( ChannelConstants.FIELD_HOSTNAME ).append( " " ).append( ChannelConstants.FIELD_HOSTNAME_DATA_TYPE ).append( ", " );
sqlBuilder.append( "UNIQUE(" ).append( ChannelConstants.FIELD_CHAN_ID ).append( ", " ).append( ChannelConstants.FIELD_HOSTNAME ).append( ")" );
sqlBuilder.append( ChannelConstants.FIELD_MASTER_HOSTNAME ).append( " " ).append( ChannelConstants.FIELD_MASTER_HOSTNAME_DATA_TYPE ).append( ", " );
sqlBuilder.append( "UNIQUE(" ).append( ChannelConstants.FIELD_CHAN_ID ).append( ", " ).append( ChannelConstants.FIELD_MASTER_HOSTNAME ).append( ")" );
sqlBuilder.append( ");" );
String sql = sqlBuilder.toString();
if( Log.isLoggable( TAG, Log.VERBOSE ) ) {
Expand Down Expand Up @@ -572,7 +573,7 @@ private void createProgramGroup( SQLiteDatabase db ) {
sqlBuilder.append( ProgramGroupConstants.FIELD_TITLE ).append( " " ).append( ProgramGroupConstants.FIELD_TITLE_DATA_TYPE ).append( ", " );
sqlBuilder.append( ProgramGroupConstants.FIELD_CATEGORY ).append( " " ).append( ProgramGroupConstants.FIELD_CATEGORY_DATA_TYPE ).append( ", " );
sqlBuilder.append( ProgramGroupConstants.FIELD_INETREF ).append( " " ).append( ProgramGroupConstants.FIELD_INETREF_DATA_TYPE ).append( ", " );
sqlBuilder.append( ProgramGroupConstants.FIELD_HOSTNAME ).append( " " ).append( ProgramGroupConstants.FIELD_HOSTNAME_DATA_TYPE );
sqlBuilder.append( ProgramGroupConstants.FIELD_MASTER_HOSTNAME ).append( " " ).append( ProgramGroupConstants.FIELD_MASTER_HOSTNAME_DATA_TYPE );
sqlBuilder.append( ");" );
String sql = sqlBuilder.toString();
if( Log.isLoggable( TAG, Log.VERBOSE ) ) {
Expand Down Expand Up @@ -612,8 +613,8 @@ private void createRecording( SQLiteDatabase db ) {
sqlBuilder.append( RecordingConstants.FIELD_PROFILE ).append( " " ).append( RecordingConstants.FIELD_PROFILE_DATA_TYPE ).append( ", " );
sqlBuilder.append( RecordingConstants.FIELD_PROGRAM_ID ).append( " " ).append( RecordingConstants.FIELD_PROGRAM_ID_DATA_TYPE ).append( ", " );
sqlBuilder.append( RecordingConstants.FIELD_START_TIME ).append( " " ).append( RecordingConstants.FIELD_START_TIME_DATA_TYPE ).append( ", " );
sqlBuilder.append( RecordingConstants.FIELD_HOSTNAME ).append( " " ).append( RecordingConstants.FIELD_HOSTNAME ).append( ", " );
sqlBuilder.append( "UNIQUE(" ).append( RecordingConstants.FIELD_RECORD_ID ).append( ", " ).append( RecordingConstants.FIELD_START_TIME ).append( ", " ).append( RecordingConstants.FIELD_HOSTNAME ).append( ")" );
sqlBuilder.append( RecordingConstants.FIELD_MASTER_HOSTNAME ).append( " " ).append( RecordingConstants.FIELD_MASTER_HOSTNAME ).append( ", " );
sqlBuilder.append( "UNIQUE(" ).append( RecordingConstants.FIELD_RECORD_ID ).append( ", " ).append( RecordingConstants.FIELD_START_TIME ).append( ", " ).append( RecordingConstants.FIELD_MASTER_HOSTNAME ).append( ")" );
sqlBuilder.append( ");" );
String sql = sqlBuilder.toString();
if( Log.isLoggable( TAG, Log.VERBOSE ) ) {
Expand Down Expand Up @@ -663,8 +664,8 @@ private void createLiveStream( SQLiteDatabase db ) {
sqlBuilder.append( LiveStreamConstants.FIELD_AUDIO_ONLY_BITRATE ).append( " " ).append( LiveStreamConstants.FIELD_AUDIO_ONLY_BITRATE_DATA_TYPE ).append( ", " );
sqlBuilder.append( LiveStreamConstants.FIELD_START_TIME ).append( " " ).append( LiveStreamConstants.FIELD_START_TIME_DATA_TYPE ).append( ", " );
sqlBuilder.append( LiveStreamConstants.FIELD_CHAN_ID ).append( " " ).append( LiveStreamConstants.FIELD_CHAN_ID_DATA_TYPE ).append( ", " );
sqlBuilder.append( LiveStreamConstants.FIELD_HOSTNAME ).append( " " ).append( LiveStreamConstants.FIELD_HOSTNAME ).append( ", " );
sqlBuilder.append( "UNIQUE(" ).append( LiveStreamConstants.FIELD_START_TIME ).append( ", " ).append( LiveStreamConstants.FIELD_CHAN_ID ).append( ", " ).append( LiveStreamConstants.FIELD_HOSTNAME ).append( ")" );
sqlBuilder.append( LiveStreamConstants.FIELD_MASTER_HOSTNAME ).append( " " ).append( LiveStreamConstants.FIELD_MASTER_HOSTNAME ).append( ", " );
sqlBuilder.append( "UNIQUE(" ).append( LiveStreamConstants.FIELD_START_TIME ).append( ", " ).append( LiveStreamConstants.FIELD_CHAN_ID ).append( ", " ).append( LiveStreamConstants.FIELD_MASTER_HOSTNAME ).append( ")" );
sqlBuilder.append( ");" );
String sql = sqlBuilder.toString();
if( Log.isLoggable( TAG, Log.VERBOSE ) ) {
Expand Down
2 changes: 1 addition & 1 deletion src/org/mythtv/db/channel/ChannelConstants.java
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,7 @@ public class ChannelConstants extends AbstractBaseConstants {
sb.append( FIELD_VISIBLE ).append( "," );
sb.append( FIELD_XMLTV_ID ).append( "," );
sb.append( FIELD_DEFAULT_AUTH ).append( "," );
sb.append( FIELD_HOSTNAME );
sb.append( FIELD_MASTER_HOSTNAME );
sb.append( " ) " );
sb.append( "VALUES( ?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,? )" );

Expand Down
6 changes: 3 additions & 3 deletions src/org/mythtv/db/channel/ChannelDaoHelper.java
Original file line number Diff line number Diff line change
Expand Up @@ -557,8 +557,8 @@ public ChannelInfo convertCursorToChannelInfo( Cursor cursor ) {
defaultAuth = cursor.getString( cursor.getColumnIndex( ChannelConstants.TABLE_NAME + "_" + ChannelConstants.FIELD_DEFAULT_AUTH ) );
}

if( cursor.getColumnIndex( ChannelConstants.TABLE_NAME + "_" + ChannelConstants.FIELD_HOSTNAME ) != -1 ) {
Log.v( TAG, "convertCursorToChannelInfo : hostname" + cursor.getString( cursor.getColumnIndex( ChannelConstants.TABLE_NAME + "_" + ChannelConstants.FIELD_HOSTNAME ) ) );
if( cursor.getColumnIndex( ChannelConstants.TABLE_NAME + "_" + ChannelConstants.FIELD_MASTER_HOSTNAME ) != -1 ) {
Log.v( TAG, "convertCursorToChannelInfo : hostname" + cursor.getString( cursor.getColumnIndex( ChannelConstants.TABLE_NAME + "_" + ChannelConstants.FIELD_MASTER_HOSTNAME ) ) );
}

ChannelInfo channelInfo = new ChannelInfo();
Expand Down Expand Up @@ -652,7 +652,7 @@ private ContentValues convertChannelInfoToContentValues( final Context context,
values.put( ChannelConstants.FIELD_VISIBLE, ( channelInfo.isVisable() ? 1 : 0 ) );
values.put( ChannelConstants.FIELD_XMLTV_ID, channelInfo.getXmltvId() );
values.put( ChannelConstants.FIELD_DEFAULT_AUTH, channelInfo.getDefaultAuth() );
values.put( ChannelConstants.FIELD_HOSTNAME, locationProfile.getHostname() );
values.put( ChannelConstants.FIELD_MASTER_HOSTNAME, locationProfile.getHostname() );

// Log.v( TAG, "convertChannelToContentValues : exit" );
return values;
Expand Down
12 changes: 6 additions & 6 deletions src/org/mythtv/db/content/LiveStreamDaoHelper.java
Original file line number Diff line number Diff line change
Expand Up @@ -211,7 +211,7 @@ public int save( final Context context, final LocationProfile locationProfile, L
if( null == context )
throw new RuntimeException( "LiveStreamDaoHelper is not initialized" );

ContentValues values = convertLiveStreamInfoToContentValues( context, locationProfile, liveStreamInfo, program );
ContentValues values = convertLiveStreamInfoToContentValues( locationProfile, liveStreamInfo, program );

String[] projection = new String[] { LiveStreamConstants.TABLE_NAME + "_" + LiveStreamConstants._ID };
String selection = LiveStreamConstants.FIELD_ID + " = ?";
Expand Down Expand Up @@ -427,8 +427,8 @@ public LiveStreamInfo convertCursorToLiveStreamInfo( Cursor cursor ) {
Log.v( TAG, "convertCursorToLiveStreamInfo : startTime=" + new DateTime( cursor.getLong( cursor.getColumnIndex( LiveStreamConstants.TABLE_NAME + "_" + LiveStreamConstants.FIELD_START_TIME ) ) ) );
}

if( cursor.getColumnIndex( LiveStreamConstants.TABLE_NAME + "_" + LiveStreamConstants.FIELD_HOSTNAME ) != -1 ) {
Log.v( TAG, "convertCursorToLiveStreamInfo : hostname=" + cursor.getString( cursor.getColumnIndex( LiveStreamConstants.TABLE_NAME + "_" + LiveStreamConstants.FIELD_HOSTNAME ) ) );
if( cursor.getColumnIndex( LiveStreamConstants.TABLE_NAME + "_" + LiveStreamConstants.FIELD_MASTER_HOSTNAME ) != -1 ) {
Log.v( TAG, "convertCursorToLiveStreamInfo : hostname=" + cursor.getString( cursor.getColumnIndex( LiveStreamConstants.TABLE_NAME + "_" + LiveStreamConstants.FIELD_MASTER_HOSTNAME ) ) );
}

LiveStreamInfo liveStreamInfo = new LiveStreamInfo();
Expand Down Expand Up @@ -488,7 +488,7 @@ private ContentValues[] convertLiveStreamInfosToContentValuesArray( final Contex
channelInfo.setChannelId( channelId );
program.setChannelInfo( channelInfo );

contentValues = convertLiveStreamInfoToContentValues( context, locationProfile, liveStreamInfo, program );
contentValues = convertLiveStreamInfoToContentValues( locationProfile, liveStreamInfo, program );
contentValuesArray.add( contentValues );

}
Expand All @@ -505,7 +505,7 @@ private ContentValues[] convertLiveStreamInfosToContentValuesArray( final Contex
return null;
}

private ContentValues convertLiveStreamInfoToContentValues( final Context context, final LocationProfile locationProfile, final LiveStreamInfo liveStreamInfo, final Program program ) {
private ContentValues convertLiveStreamInfoToContentValues( final LocationProfile locationProfile, final LiveStreamInfo liveStreamInfo, final Program program ) {
// Log.v( TAG, "convertLiveStreamToContentValues : enter" );

ContentValues values = new ContentValues();
Expand Down Expand Up @@ -534,7 +534,7 @@ private ContentValues convertLiveStreamInfoToContentValues( final Context contex
values.put( LiveStreamConstants.FIELD_AUDIO_ONLY_BITRATE, liveStreamInfo.getAudioOnlyBitrate() );
values.put( LiveStreamConstants.FIELD_CHAN_ID, program.getChannelInfo().getChannelId() );
values.put( LiveStreamConstants.FIELD_START_TIME, program.getStartTime().getMillis() );
values.put( LiveStreamConstants.FIELD_HOSTNAME, locationProfile.getHostname() );
values.put( LiveStreamConstants.FIELD_MASTER_HOSTNAME, locationProfile.getHostname() );

// Log.v( TAG, "convertLiveStreamToContentValues : exit" );
return values;
Expand Down
11 changes: 8 additions & 3 deletions src/org/mythtv/db/dvr/ProgramConstants.java
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,9 @@ public class ProgramConstants extends AbstractBaseConstants {
public static final String FIELD_PROGRAM_FLAGS = "PROGRAM_FLAGS";
public static final String FIELD_PROGRAM_FLAGS_DATA_TYPE = "TEXT";

public static final String FIELD_HOSTNAME = "HOSTNAME";
public static final String FIELD_HOSTNAME_DATA_TYPE = "TEXT";

public static final String FIELD_FILENAME = "FILENAME";
public static final String FIELD_FILENAME_DATA_TYPE = "TEXT";

Expand Down Expand Up @@ -120,7 +123,7 @@ public class ProgramConstants extends AbstractBaseConstants {
FIELD_START_TIME, FIELD_END_TIME, FIELD_TITLE, FIELD_SUB_TITLE, FIELD_CATEGORY, FIELD_CATEGORY_TYPE, FIELD_REPEAT,
FIELD_VIDEO_PROPS, FIELD_AUDIO_PROPS, FIELD_SUB_PROPS, FIELD_SERIES_ID, FIELD_PROGRAM_ID, FIELD_STARS, FIELD_FILE_SIZE,
FIELD_LAST_MODIFIED, FIELD_PROGRAM_FLAGS, FIELD_HOSTNAME, FIELD_FILENAME, FIELD_AIR_DATE, FIELD_DESCRIPTION,
FIELD_INETREF, FIELD_SEASON, FIELD_EPISODE, FIELD_CHANNEL_ID, FIELD_RECORD_ID, FIELD_IN_ERROR
FIELD_INETREF, FIELD_SEASON, FIELD_EPISODE, FIELD_CHANNEL_ID, FIELD_RECORD_ID, FIELD_IN_ERROR, FIELD_MASTER_HOSTNAME
};

static {
Expand Down Expand Up @@ -150,11 +153,12 @@ public class ProgramConstants extends AbstractBaseConstants {
insert.append( FIELD_EPISODE ).append( "," );
insert.append( FIELD_CHANNEL_ID ).append( ", " );
insert.append( FIELD_RECORD_ID ).append( ", " );
insert.append( FIELD_IN_ERROR );
insert.append( FIELD_IN_ERROR ).append( ", " );
insert.append( FIELD_MASTER_HOSTNAME );

StringBuilder values = new StringBuilder();
values.append( " ) " );
values.append( "VALUES( ?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,? )" );
values.append( "VALUES( ?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,? )" );

StringBuilder insertProgram = new StringBuilder();
insertProgram.append( "INSERT INTO " ).append( TABLE_NAME_PROGRAM ).append( " ( " );
Expand Down Expand Up @@ -199,6 +203,7 @@ public class ProgramConstants extends AbstractBaseConstants {
update.append( FIELD_RECORD_ID ).append( " = ?, " );
update.append( FIELD_HOSTNAME ).append( "= ?" );
update.append( FIELD_IN_ERROR ).append( "= ?" );
update.append( FIELD_MASTER_HOSTNAME ).append( "= ?");
update.append( " WHERE " );
update.append( FIELD_CHANNEL_ID ).append( " = ? AND " );
update.append( FIELD_START_TIME ).append( " = ?" );
Expand Down
Loading

0 comments on commit 238064a

Please sign in to comment.