Permalink
Browse files

Added a more roles.

  • Loading branch information...
enternoescape committed Jan 14, 2017
1 parent 2a441e5 commit 79a89ae2ef50ae9a26e163513378651aa5e760b2
Showing with 219 additions and 44 deletions.
  1. +22 −1 i18n/SageTVCoreTranslations.properties
  2. +51 −15 java/sage/Show.java
  3. +146 −28 java/sage/epg/sd/json/programs/SDPerson.java
@@ -482,4 +482,25 @@ LINEUP_SD_ACCOUNT_DISABLED_MSG=The Schedules Direct account is disabled. Please
LINEUP_SD_ACCOUNT_EXPIRED=Schedules Direct Account Expired
LINEUP_SD_ACCOUNT_EXPIRED_MSG=The Schedules Direct account has expired. Please renew the account subscription to continue to receive EPG updates.
LINEUP_SD_ACCOUNT_LOCKOUT=Schedules Direct Account Locked
-LINEUP_SD_ACCOUNT_LOCKOUT_MSG=The Schedules Direct account is locked. There have been too many login failures. The account will unlock again in 15 minutes.
+LINEUP_SD_ACCOUNT_LOCKOUT_MSG=The Schedules Direct account is locked. There have been too many login failures. The account will unlock again in 15 minutes.
+Team=Team
+Guest_Voice=Guest Voice
+Anchor=Anchor
+Voice=Voice
+Musical_Guest=Musical Guest
+Film_Editor=Film Editor
+Casting=Casting
+Cinematographer=Cinematographer
+Costume_Designer=Costume Designer
+Production_Design=Production Design
+Creator=Creator
+CoProducer=Co-Producer
+Associate_Producer=Associate Producer
+First_Assistant_Director=First Assistant Director
+Supervising_Art_Direction=Supervising Art Direction
+CoExecutive_Producer=Co-Executive Producer
+Director_of_Photography=Director of Photography
+Unit_Production_Manager=Unit Production Manager
+Makeup_Artist=Makeup Artist
+Assistant_Director=Assistant Director
+Music_Supervisor=Music Supervisor
View
@@ -56,7 +56,24 @@
public static final byte ANCHOR_ROLE = 26;
public static final byte VOICE_ROLE = 27;
public static final byte MUSICAL_GUEST_ROLE = 28;
- public static final byte MAX_ROLE_NUM = 28;
+ public static final byte FILM_EDITOR_ROLE = 29;
+ public static final byte MUSIC_ROLE = 30;
+ public static final byte CASTING_ROLE = 31;
+ public static final byte CINEMATOGRAPHER_ROLE = 32;
+ public static final byte COSTUME_DESIGNER_ROLE = 33;
+ public static final byte PRODUCTION_DESIGN_ROLE = 34;
+ public static final byte CREATOR_ROLE = 35;
+ public static final byte CO_PRODUCER_ROLE = 36;
+ public static final byte ASSOCIATE_PRODUCER_ROLE = 37;
+ public static final byte FIRST_ASSISTANT_DIRECTOR_ROLE = 38;
+ public static final byte SUPERVISING_ART_DIRECTION_ROLE = 39;
+ public static final byte CO_EXECUTIVE_PRODUCER_ROLE = 40;
+ public static final byte DIRECTOR_OF_PHOTOGRAPHY_ROLE = 41;
+ public static final byte UNIT_PRODUCTION_MANAGER_ROLE = 42;
+ public static final byte MAKEUP_ARTIST_ROLE = 43;
+ public static final byte ASSISTANT_DIRECTOR_ROLE = 44;
+ public static final byte MUSIC_SUPERVISOR_ROLE = 45;
+ public static final byte MAX_ROLE_NUM = 45;
public static final byte ALL_ROLES = 127;
public static String[] getRoleNames()
@@ -69,8 +86,15 @@
Sage.rez("Coach"), Sage.rez("Host"), Sage.rez("Executive_Producer"),
Sage.rez("Artist"), Sage.rez("Album_Artist"), Sage.rez("Composer"),
Sage.rez("Judge"), Sage.rez("Narrator"), Sage.rez("Contestant"),
- Sage.rez("Correspondent"), Sage.rez("Team"), Sage.rez("Guest Voice"),
- Sage.rez("Anchor"), Sage.rez("Voice"), Sage.rez("Musical Guest")
+ Sage.rez("Correspondent"), Sage.rez("Team"), Sage.rez("Guest_Voice"),
+ Sage.rez("Anchor"), Sage.rez("Voice"), Sage.rez("Musical_Guest"),
+ Sage.rez("Film_Editor"), Sage.rez("Music"), Sage.rez("Casting"),
+ Sage.rez("Cinematographer"), Sage.rez("Costume_Designer"), Sage.rez("Production_Design"),
+ Sage.rez("Creator"), Sage.rez("CoProducer"), Sage.rez("Associate_Producer"),
+ Sage.rez("First_Assistant_Director"), Sage.rez("Supervising_Art_Direction"),
+ Sage.rez("CoExecutive_Producer"), Sage.rez("Director_of_Photography"),
+ Sage.rez("Unit_Production_Manager"), Sage.rez("Makeup_Artist"),
+ Sage.rez("Assistant_Director"), Sage.rez("Music_Supervisor")
};
}
@@ -1238,7 +1262,7 @@ public String getAnyImageUrl(int prefIndex)
if (SDImages.getImageCount(i, imageURLs) > prefIndex)
{
int realIndex = imageURLs[0][i] + prefIndex;
- return SDImages.decodeImageUrl(showcardID, imageURLs[realIndex]);
+ return SDImages.decodeShowImageUrl(showcardID, imageURLs[realIndex]);
}
i += 2;
@@ -1251,7 +1275,7 @@ public String getAnyImageUrl(int prefIndex)
if (SDImages.getImageCount(i, imageURLs) > 0)
{
int realIndex = imageURLs[0][i];
- return SDImages.decodeImageUrl(showcardID, imageURLs[realIndex]);
+ return SDImages.decodeShowImageUrl(showcardID, imageURLs[realIndex]);
}
i += 2;
@@ -1288,35 +1312,47 @@ public String getAnyImageUrl(int prefIndex)
return getImageIdUrl(imageIDs[0], seriesID, showcardID, getExternalID(), false);
}
+ /**
+ * Returns an image URL that's representative of this Movie
+ * <p/>
+ * If no images are available with the preferred index, any image will be returned.
+ *
+ * @param prefIndex The preferred image index.
+ * @param thumb Request thumbnail size image.
+ * @return A URL if an image was available or <code>null</code> if no images are available.
+ */
public String getAnyImageUrl(int prefIndex, boolean thumb)
{
if (imageURLs.length > 1)
{
- // Thumbnails are even numbers and full images are odd.
+ // Thumbnails are even numbers and full images are odd. We are indexing in reverse because
+ // this will get us box art, then poster and last photo which is generally preferred for
+ // movies.
+
// Try to get preferred image URL.
- int i = thumb ? 0 : 1;
- while (i < imageURLs[0].length)
+ int i = thumb ? imageURLs[0].length - 2 : imageURLs[0].length - 1;
+ while (i > 0)
{
if (SDImages.getImageCount(i, imageURLs) > prefIndex)
{
int realIndex = imageURLs[0][i] + prefIndex;
- return SDImages.decodeImageUrl(showcardID, imageURLs[realIndex]);
+ return SDImages.decodeShowImageUrl(showcardID, imageURLs[realIndex]);
}
- i += 2;
+ i -= 2;
}
// Get any image URL.
- i = thumb ? 0 : 1;
- while (i < imageURLs[0].length)
+ i = thumb ? imageURLs[0].length - 2 : imageURLs[0].length - 1;
+ while (i > 0)
{
if (SDImages.getImageCount(i, imageURLs) > 0)
{
int realIndex = imageURLs[0][i];
- return SDImages.decodeImageUrl(showcardID, imageURLs[realIndex]);
+ return SDImages.decodeShowImageUrl(showcardID, imageURLs[realIndex]);
}
- i += 2;
+ i -= 2;
}
return null;
@@ -1362,7 +1398,7 @@ public String getImageUrlForIndex(int idx, boolean thumb)
if (currentCount > idx)
{
int realIndex = imageURLs[0][i] + idx;
- return SDImages.decodeImageUrl(showcardID, imageURLs[realIndex]);
+ return SDImages.decodeShowImageUrl(showcardID, imageURLs[realIndex]);
}
idx -= currentCount;
@@ -15,8 +15,7 @@
*/
package sage.epg.sd.json.programs;
-import sage.EPGDBPublic;
-import sage.EPGDBPublic2;
+import sage.Show;
public class SDPerson
{
@@ -53,6 +52,20 @@ public String getPersonId()
return personId;
}
+ public int getPersonIdAsInt()
+ {
+ if (personId == null || personId.length() == 0)
+ return 0;
+ try
+ {
+ return Integer.parseInt(personId);
+ }
+ catch (NumberFormatException e)
+ {
+ return 0;
+ }
+ }
+
/**
* string for this person. Used to differentiate people that have various names, such as due to
* marriage, divorce, etc. Optional. Actors in adult movies will typically not have a personID or
@@ -66,6 +79,25 @@ public String getNameId()
return nameId;
}
+ public int getNameIdAsInt()
+ {
+ if (nameId == null || nameId.length() == 0)
+ return 0;
+ try
+ {
+ return Integer.parseInt(nameId);
+ }
+ catch (NumberFormatException e)
+ {
+ return 0;
+ }
+ }
+
+ public boolean isAlias()
+ {
+ return personId != null && personId.length() > 0 && personId.equals(nameId);
+ }
+
/**
* string indicating the person's name. Mandatory.
*/
@@ -93,67 +125,136 @@ public byte getRoleID()
switch (role)
{
case "Actor":
- return EPGDBPublic.ACTOR_ROLE;
+ return Show.ACTOR_ROLE;
case "Actress":
- return EPGDBPublic.ACTRESS_ROLE;
+ return Show.ACTRESS_ROLE;
case "Choreographer":
- return EPGDBPublic.CHOREOGRAPHER_ROLE;
+ return Show.CHOREOGRAPHER_ROLE;
case "Coach":
- return EPGDBPublic.COACH_ROLE;
+ return Show.COACH_ROLE;
case "Director":
- return EPGDBPublic.DIRECTOR_ROLE;
+ return Show.DIRECTOR_ROLE;
case "Executive Producer":
- return EPGDBPublic.EXECUTIVE_PRODUCER_ROLE;
+ return Show.EXECUTIVE_PRODUCER_ROLE;
case "Guest":
- return EPGDBPublic.GUEST_ROLE;
+ return Show.GUEST_ROLE;
case "Guest Star":
- return EPGDBPublic.GUEST_STAR_ROLE;
+ return Show.GUEST_STAR_ROLE;
case "Host":
- return EPGDBPublic.HOST_ROLE;
+ return Show.HOST_ROLE;
case "Judge":
- return EPGDBPublic.JUDGE_ROLE;
+ return Show.JUDGE_ROLE;
case "Lead Actor":
- return EPGDBPublic.LEAD_ACTOR_ROLE;
+ return Show.LEAD_ACTOR_ROLE;
case "Lead Actress":
- return EPGDBPublic.LEAD_ACTRESS_ROLE;
+ return Show.LEAD_ACTRESS_ROLE;
case "Narrator":
- return EPGDBPublic.NARRATOR_ROLE;
+ return Show.NARRATOR_ROLE;
case "Producer":
- return EPGDBPublic.PRODUCER_ROLE;
+ return Show.PRODUCER_ROLE;
case "Sports Figure":
- return EPGDBPublic.SPORTS_FIGURE_ROLE;
+ return Show.SPORTS_FIGURE_ROLE;
case "Supporting Actor":
- return EPGDBPublic.SUPPORTING_ACTOR_ROLE;
+ return Show.SUPPORTING_ACTOR_ROLE;
case "Supporting Actress":
- return EPGDBPublic.SUPPORTING_ACTRESS_ROLE;
+ return Show.SUPPORTING_ACTRESS_ROLE;
case "Writer":
- return EPGDBPublic.WRITER_ROLE;
+ case "Screenwriter":
+ case "Screen Story Writer":
+ case "Screen Story":
+ return Show.WRITER_ROLE;
case "Contestant":
- return EPGDBPublic2.CONTESTANT_ROLE;
+ return Show.CONTESTANT_ROLE;
case "Correspondent":
- return EPGDBPublic2.CORRESPONDENT_ROLE;
+ return Show.CORRESPONDENT_ROLE;
case "Team":
- return EPGDBPublic2.TEAM_ROLE;
+ return Show.TEAM_ROLE;
case "Guest Voice":
- return EPGDBPublic2.GUEST_VOICE_ROLE;
+ return Show.GUEST_VOICE_ROLE;
case "Anchor":
- return EPGDBPublic2.ANCHOR_ROLE;
+ return Show.ANCHOR_ROLE;
case "Voice":
- return EPGDBPublic2.VOICE_ROLE;
+ return Show.VOICE_ROLE;
case "Musical Guest":
- return EPGDBPublic2.MUSICAL_GUEST_ROLE;
+ return Show.MUSICAL_GUEST_ROLE;
+ case "Composer":
+ return Show.COMPOSER_ROLE;
+ case "Film Editor":
+ return Show.FILM_EDITOR_ROLE;
+ case "Music Theme":
+ case "Music Score:":
+ case "Non-Original Music":
+ case "Original Music":
+ case "Music":
+ return Show.MUSIC_ROLE;
+ case "Casting":
+ return Show.CASTING_ROLE;
+ case "Cinematographer":
+ return Show.CINEMATOGRAPHER_ROLE;
+ case "Costume Designer":
+ return Show.COSTUME_DESIGNER_ROLE;
+ case "Production Design":
+ case "Production Designer":
+ case "Art Director":
+ case "Art Direction":
+ case "Set Decoration":
+ return Show.PRODUCTION_DESIGN_ROLE;
+ case "Creator":
+ return Show.CREATOR_ROLE;
+ case "Co-Producer":
+ return Show.CO_PRODUCER_ROLE;
+ case "Associate Producer":
+ return Show.ASSOCIATE_PRODUCER_ROLE;
+ case "First Assistant Director":
+ return Show.FIRST_ASSISTANT_DIRECTOR_ROLE;
+ case "Supervising Art Direction":
+ return Show.SUPERVISING_ART_DIRECTION_ROLE;
+ case "Co-Executive Producer":
+ return Show.CO_EXECUTIVE_PRODUCER_ROLE;
+ case "Director of Photography":
+ return Show.DIRECTOR_OF_PHOTOGRAPHY_ROLE;
+ case "Unit Production Manager":
+ return Show.UNIT_PRODUCTION_MANAGER_ROLE;
+ case "Key Makeup Artist":
+ case "Makeup Artist":
+ return Show.MAKEUP_ARTIST_ROLE;
+ case "Assistant Director":
+ return Show.ASSISTANT_DIRECTOR_ROLE;
+ case "Music Supervisor":
+ return Show.MUSIC_SUPERVISOR_ROLE;
}
+ if (role.contains("Choreographer"))
+ return Show.CHOREOGRAPHER_ROLE;
+ else if (role.contains("Coach"))
+ return Show.COACH_ROLE;
+ else if (role.startsWith("Executive Producer, ")) // Various language executive producers
+ return Show.EXECUTIVE_PRODUCER_ROLE;
+ else if (role.startsWith("Producer, ")) // Various language producers
+ return Show.PRODUCER_ROLE;
+ else if (role.startsWith("Director, ")) // Various language directors
+ return Show.PRODUCER_ROLE;
+ else if (role.startsWith("Writer (") || role.startsWith("Screenwriter"))
+ return Show.WRITER_ROLE;
+
return 0;
}
/**
* string indicating the name of the character this person played. Optional.
+ * <p/>
+ * If a character name does not exist, their role is returned instead.
*/
public String getCharacterName()
{
- if (characterName == null)
+ if (characterName == null || characterName.length() == 0)
+ {
+ if (role != null)
+ {
+ return role;
+ }
return "";
+ }
return characterName;
}
@@ -181,4 +282,21 @@ public String toString()
", billingOrder='" + billingOrder + '\'' +
'}';
}
+
+ @Override
+ public boolean equals(Object o)
+ {
+ if (this == o) return true;
+ if (o == null || getClass() != o.getClass()) return false;
+
+ SDPerson person = (SDPerson) o;
+
+ return personId != null ? personId.equals(person.personId) : person.personId == null;
+ }
+
+ @Override
+ public int hashCode()
+ {
+ return personId != null ? personId.hashCode() : 0;
+ }
}

0 comments on commit 79a89ae

Please sign in to comment.