Home | History | Annotate | Download | only in provider
      1 /*
      2  * Copyright (C) 2015 The Android Open Source Project
      3  *
      4  * Licensed under the Apache License, Version 2.0 (the "License");
      5  * you may not use this file except in compliance with the License.
      6  * You may obtain a copy of the License at
      7  *
      8  *      http://www.apache.org/licenses/LICENSE-2.0
      9  *
     10  * Unless required by applicable law or agreed to in writing, software
     11  * distributed under the License is distributed on an "AS IS" BASIS,
     12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
     13  * See the License for the specific language governing permissions and
     14  * limitations under the License.
     15  */
     16 
     17 package com.android.tv.dvr.provider;
     18 
     19 import android.provider.BaseColumns;
     20 
     21 /**
     22  * The contract between the DVR provider and applications. Contains definitions for the supported
     23  * columns. It's for the internal use in Live TV.
     24  */
     25 public final class DvrContract {
     26     /** Column definition for Schedules table. */
     27     public static final class Schedules implements BaseColumns {
     28         /** The table name. */
     29         public static final String TABLE_NAME = "schedules";
     30 
     31         /** The recording type for program recording. */
     32         public static final String TYPE_PROGRAM = "TYPE_PROGRAM";
     33 
     34         /** The recording type for timed recording. */
     35         public static final String TYPE_TIMED = "TYPE_TIMED";
     36 
     37         /** The recording has not been started yet. */
     38         public static final String STATE_RECORDING_NOT_STARTED = "STATE_RECORDING_NOT_STARTED";
     39 
     40         /** The recording is in progress. */
     41         public static final String STATE_RECORDING_IN_PROGRESS = "STATE_RECORDING_IN_PROGRESS";
     42 
     43         /** The recording is finished. */
     44         public static final String STATE_RECORDING_FINISHED = "STATE_RECORDING_FINISHED";
     45 
     46         /** The recording failed. */
     47         public static final String STATE_RECORDING_FAILED = "STATE_RECORDING_FAILED";
     48 
     49         /** The recording finished and clipping. */
     50         public static final String STATE_RECORDING_CLIPPED = "STATE_RECORDING_CLIPPED";
     51 
     52         /** The recording marked as deleted. */
     53         public static final String STATE_RECORDING_DELETED = "STATE_RECORDING_DELETED";
     54 
     55         /** The recording marked as canceled. */
     56         public static final String STATE_RECORDING_CANCELED = "STATE_RECORDING_CANCELED";
     57 
     58         /**
     59          * The priority of this recording.
     60          *
     61          * <p> The lowest number is recorded first. If there is a tie in priority then the lower id
     62          * wins.  Defaults to {@value Long#MAX_VALUE}
     63          *
     64          * <p>Type: INTEGER (long)
     65          */
     66         public static final String COLUMN_PRIORITY = "priority";
     67 
     68         /**
     69          * The type of this recording.
     70          *
     71          * <p>This value should be one of the followings: {@link #TYPE_PROGRAM} and
     72          * {@link #TYPE_TIMED}.
     73          *
     74          * <p>This is a required field.
     75          *
     76          * <p>Type: TEXT
     77          */
     78         public static final String COLUMN_TYPE = "type";
     79 
     80         /**
     81          * The input id of recording.
     82          *
     83          * <p>This is a required field.
     84          *
     85          * <p>Type: TEXT
     86          */
     87         public static final String COLUMN_INPUT_ID = "input_id";
     88 
     89         /**
     90          * The ID of the channel for recording.
     91          *
     92          * <p>This is a required field.
     93          *
     94          * <p>Type: INTEGER (long)
     95          */
     96         public static final String COLUMN_CHANNEL_ID = "channel_id";
     97 
     98         /**
     99          * The ID of the associated program for recording.
    100          *
    101          * <p>This is an optional field.
    102          *
    103          * <p>Type: INTEGER (long)
    104          */
    105         public static final String COLUMN_PROGRAM_ID = "program_id";
    106 
    107         /**
    108          * The title of the associated program for recording.
    109          *
    110          * <p>This is an optional field.
    111          *
    112          * <p>Type: TEXT
    113          */
    114         public static final String COLUMN_PROGRAM_TITLE = "program_title";
    115 
    116         /**
    117          * The start time of this recording, in milliseconds since the epoch.
    118          *
    119          * <p>This is a required field.
    120          *
    121          * <p>Type: INTEGER (long)
    122          */
    123         public static final String COLUMN_START_TIME_UTC_MILLIS = "start_time_utc_millis";
    124 
    125         /**
    126          * The end time of this recording, in milliseconds since the epoch.
    127          *
    128          * <p>This is a required field.
    129          *
    130          * <p>Type: INTEGER (long)
    131          */
    132         public static final String COLUMN_END_TIME_UTC_MILLIS = "end_time_utc_millis";
    133 
    134         /**
    135          * The season number of this program for episodic TV shows.
    136          *
    137          * <p>Type: TEXT
    138          */
    139         public static final String COLUMN_SEASON_NUMBER = "season_number";
    140 
    141         /**
    142          * The episode number of this program for episodic TV shows.
    143          *
    144          * <p>Type: TEXT
    145          */
    146         public static final String COLUMN_EPISODE_NUMBER = "episode_number";
    147 
    148         /**
    149          * The episode title of this program for episodic TV shows.
    150          *
    151          * <p>Type: TEXT
    152          */
    153         public static final String COLUMN_EPISODE_TITLE = "episode_title";
    154 
    155         /**
    156          * The description of program.
    157          *
    158          * <p>Type: TEXT
    159          */
    160         public static final String COLUMN_PROGRAM_DESCRIPTION = "program_description";
    161 
    162         /**
    163          * The long description of program.
    164          *
    165          * <p>Type: TEXT
    166          */
    167         public static final String COLUMN_PROGRAM_LONG_DESCRIPTION = "program_long_description";
    168 
    169         /**
    170          * The poster art uri of program.
    171          *
    172          * <p>Type: TEXT
    173          */
    174         public static final String COLUMN_PROGRAM_POST_ART_URI = "program_poster_art_uri";
    175 
    176         /**
    177          * The thumbnail uri of program.
    178          *
    179          * <p>Type: TEXT
    180          */
    181         public static final String COLUMN_PROGRAM_THUMBNAIL_URI = "program_thumbnail_uri";
    182 
    183         /**
    184          * The state of this recording.
    185          *
    186          * <p>This value should be one of the followings: {@link #STATE_RECORDING_NOT_STARTED},
    187          * {@link #STATE_RECORDING_IN_PROGRESS}, {@link #STATE_RECORDING_FINISHED},
    188          * {@link #STATE_RECORDING_FAILED}, {@link #STATE_RECORDING_CLIPPED} and
    189          * {@link #STATE_RECORDING_DELETED}.
    190          *
    191          * <p>This is a required field.
    192          *
    193          * <p>Type: TEXT
    194          */
    195         public static final String COLUMN_STATE = "state";
    196 
    197         /**
    198          * The ID of the parent series recording.
    199          *
    200          * <p>Type: INTEGER (long)
    201          */
    202         public static final String COLUMN_SERIES_RECORDING_ID = "series_recording_id";
    203 
    204         private Schedules() { }
    205     }
    206 
    207     /** Column definition for Recording table. */
    208     public static final class SeriesRecordings implements BaseColumns {
    209         /** The table name. */
    210         public static final String TABLE_NAME = "series_recording";
    211 
    212         /**
    213          * This value is used for {@link #COLUMN_START_FROM_SEASON} and
    214          * {@link #COLUMN_START_FROM_EPISODE} to mean record all seasons or episodes.
    215          */
    216         public static final int THE_BEGINNING = -1;
    217 
    218         /**
    219          * The series recording option which indicates that the episodes in one channel are
    220          * recorded.
    221          */
    222         public static final String OPTION_CHANNEL_ONE = "OPTION_CHANNEL_ONE";
    223 
    224         /**
    225          * The series recording option which indicates that the episodes in all the channels are
    226          * recorded.
    227          */
    228         public static final String OPTION_CHANNEL_ALL = "OPTION_CHANNEL_ALL";
    229 
    230         /**
    231          * The state indicates that it is a normal one.
    232          */
    233         public static final String STATE_SERIES_NORMAL = "STATE_SERIES_NORMAL";
    234 
    235         /**
    236          * The state indicates that it is stopped.
    237          */
    238         public static final String STATE_SERIES_STOPPED = "STATE_SERIES_STOPPED";
    239 
    240         /**
    241          * The priority of this recording.
    242          *
    243          * <p> The lowest number is recorded first. If there is a tie in priority then the lower id
    244          * wins.  Defaults to {@value Long#MAX_VALUE}
    245          *
    246          * <p>Type: INTEGER (long)
    247          */
    248         public static final String COLUMN_PRIORITY = "priority";
    249 
    250         /**
    251          * The input id of recording.
    252          *
    253          * <p>This is a required field.
    254          *
    255          * <p>Type: TEXT
    256          */
    257         public static final String COLUMN_INPUT_ID = "input_id";
    258 
    259         /**
    260          * The ID of the channel for recording.
    261          *
    262          * <p>This is a required field.
    263          *
    264          * <p>Type: INTEGER (long)
    265          */
    266         public static final String COLUMN_CHANNEL_ID = "channel_id";
    267 
    268         /**
    269          * The  ID of the associated series to record.
    270          *
    271          * <p>The id is an opaque but stable string.
    272          *
    273          * <p>This is an optional field.
    274          *
    275          * <p>Type: TEXT
    276          */
    277         public static final String COLUMN_SERIES_ID = "series_id";
    278 
    279         /**
    280          * The title of the series.
    281          *
    282          * <p>This is a required field.
    283          *
    284          * <p>Type: TEXT
    285          */
    286         public static final String COLUMN_TITLE = "title";
    287 
    288         /**
    289          * The short description of the series.
    290          *
    291          * <p>Type: TEXT
    292          */
    293         public static final String COLUMN_SHORT_DESCRIPTION = "short_description";
    294 
    295         /**
    296          * The long description of the series.
    297          *
    298          * <p>Type: TEXT
    299          */
    300         public static final String COLUMN_LONG_DESCRIPTION = "long_description";
    301 
    302         /**
    303          * The number of the earliest season to record. The
    304          * value {@link #THE_BEGINNING} means record all seasons.
    305          *
    306          * <p>Default value is {@value #THE_BEGINNING} {@link #THE_BEGINNING}.
    307          *
    308          * <p>Type: INTEGER (int)
    309          */
    310         public static final String COLUMN_START_FROM_SEASON = "start_from_season";
    311 
    312         /**
    313          * The number of the earliest episode to record in {@link #COLUMN_START_FROM_SEASON}.  The
    314          * value {@link #THE_BEGINNING} means record all episodes.
    315          *
    316          * <p>Default value is {@value #THE_BEGINNING} {@link #THE_BEGINNING}.
    317          *
    318          * <p>Type: INTEGER (int)
    319          */
    320         public static final String COLUMN_START_FROM_EPISODE = "start_from_episode";
    321 
    322         /**
    323          * The series recording option which indicates the channels to record.
    324          *
    325          * <p>This value should be one of the followings: {@link #OPTION_CHANNEL_ONE} and
    326          * {@link #OPTION_CHANNEL_ALL}. The default value is OPTION_CHANNEL_ONE.
    327          *
    328          * <p>Type: TEXT
    329          */
    330         public static final String COLUMN_CHANNEL_OPTION = "channel_option";
    331 
    332         /**
    333          * The comma-separated canonical genre string of this series.
    334          *
    335          * <p>Canonical genres are defined in {@link android.media.tv.TvContract.Programs.Genres}.
    336          * Use {@link android.media.tv.TvContract.Programs.Genres#encode} to create a text that can
    337          * be stored in this column. Use {@link android.media.tv.TvContract.Programs.Genres#decode}
    338          * to get the canonical genre strings from the text stored in the column.
    339          *
    340          * <p>Type: TEXT
    341          * @see android.media.tv.TvContract.Programs.Genres
    342          * @see android.media.tv.TvContract.Programs.Genres#encode
    343          * @see android.media.tv.TvContract.Programs.Genres#decode
    344          */
    345         public static final String COLUMN_CANONICAL_GENRE = "canonical_genre";
    346 
    347         /**
    348          * The URI for the poster of this TV series.
    349          *
    350          * <p>The data in the column must be a URL, or a URI in one of the following formats:
    351          *
    352          * <ul>
    353          * <li>content ({@link android.content.ContentResolver#SCHEME_CONTENT})</li>
    354          * <li>android.resource ({@link android.content.ContentResolver#SCHEME_ANDROID_RESOURCE})
    355          * </li>
    356          * <li>file ({@link android.content.ContentResolver#SCHEME_FILE})</li>
    357          * </ul>
    358          *
    359          * <p>Type: TEXT
    360          */
    361         public static final String COLUMN_POSTER_URI = "poster_uri";
    362 
    363         /**
    364          * The URI for the photo of this TV program.
    365          *
    366          * <p>The data in the column must be a URL, or a URI in one of the following formats:
    367          *
    368          * <ul>
    369          * <li>content ({@link android.content.ContentResolver#SCHEME_CONTENT})</li>
    370          * <li>android.resource ({@link android.content.ContentResolver#SCHEME_ANDROID_RESOURCE})
    371          * </li>
    372          * <li>file ({@link android.content.ContentResolver#SCHEME_FILE})</li>
    373          * </ul>
    374          *
    375          * <p>Type: TEXT
    376          */
    377         public static final String COLUMN_PHOTO_URI = "photo_uri";
    378 
    379         /**
    380          * The state of whether the series recording be canceled or not.
    381          *
    382          * <p>This value should be one of the followings: {@link #STATE_SERIES_NORMAL} and
    383          * {@link #STATE_SERIES_STOPPED}. The default value is STATE_SERIES_NORMAL.
    384          *
    385          * <p>Type: TEXT
    386          */
    387         public static final String COLUMN_STATE = "state";
    388 
    389         private SeriesRecordings() { }
    390     }
    391 
    392     private DvrContract() { }
    393 }
    394