Skip to content

Commit

Permalink
feat: 馃帀 Live TV can now be enabled/disabled for Jellyfin/Emby invites
Browse files Browse the repository at this point in the history
  • Loading branch information
JamsRepos committed Apr 22, 2024
1 parent 3b0d4e0 commit 8723d1c
Show file tree
Hide file tree
Showing 7 changed files with 35 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -15,3 +15,4 @@ class Invitations(BaseModel):
plex_allow_sync = BooleanField(null=True, default=None)
plex_home = BooleanField(null=True, default=None)
sessions = CharField(null=True, default=None)
live_tv = BooleanField(null=True, default=None)
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ class InvitationsModel(Model):
specific_libraries = SpecificLibrariesType(required=False, default=[])
plex_allow_sync = BooleanType(required=False, default=False)
sessions = IntType(required=False, default=None)
live_tv = BooleanType(required=False, default=False)
plex_home = BooleanType(required=False, default=False)
used_at = DateTimeType(required=False, default=None, convert_tz=True)
created = DateTimeType(required=False, default=datetime.utcnow(), convert_tz=True)
Expand Down
7 changes: 7 additions & 0 deletions apps/wizarr-backend/wizarr_backend/helpers/emby.py
Original file line number Diff line number Diff line change
Expand Up @@ -278,6 +278,13 @@ def invite_emby_user(username: str, password: str, code: str, server_api_key: Op
else:
new_policy["SimultaneousStreamLimit"] = 0

# Set live tv access
if invitation.live_tv is not None and invitation.live_tv == True:
new_policy["EnableLiveTvAccess"] = True
else:
new_policy["EnableLiveTvAccess"] = False

# Get users default policy
old_policy = user_response["Policy"]

# Merge policy with user policy don't overwrite
Expand Down
7 changes: 7 additions & 0 deletions apps/wizarr-backend/wizarr_backend/helpers/jellyfin.py
Original file line number Diff line number Diff line change
Expand Up @@ -273,6 +273,13 @@ def invite_jellyfin_user(username: str, password: str, code: str, server_api_key
else:
new_policy["MaxActiveSessions"] = 0

# Set live tv access
if invitation.live_tv is not None and invitation.live_tv == True:
new_policy["EnableLiveTvAccess"] = False
else:
new_policy["EnableLiveTvAccess"] = True

# Get users default policy
old_policy = user_response["Policy"]

# Merge policy with user policy don't overwrite
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -180,12 +180,20 @@ export default defineComponent({
label: "Unlimited Invitation Usages",
value: "unlimited",
},
live_tv: {
label: "Access to Live TV",
value: "live_tv",
},
},
emby: {
unlimited: {
label: "Unlimited Invitation Usages",
value: "unlimited",
},
live_tv: {
label: "Access to Live TV",
value: "live_tv",
},
},
plex: {
unlimited: {
Expand Down Expand Up @@ -256,6 +264,7 @@ export default defineComponent({
const unlimited = invitationData.checkboxes.includes("unlimited");
const plex_home = invitationData.checkboxes.includes("plex_home");
const plex_allow_sync = invitationData.checkboxes.includes("plex_allow_sync");
const live_tv = invitationData.checkboxes.includes("live_tv");
const sessions = invitationData.sessions;
const duration = invitationData.duration == "custom" ? this.$filter("toMinutes", invitationData.customDuration) : invitationData.duration == "unlimited" ? null : invitationData.duration;
const libraries = invitationData.libraries;
Expand All @@ -266,6 +275,7 @@ export default defineComponent({
unlimited: unlimited,
plex_home: plex_home,
plex_allow_sync: plex_allow_sync,
live_tv: live_tv,
sessions: sessions,
duration: duration,
specific_libraries: JSON.stringify(libraries),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -102,12 +102,20 @@ export default defineComponent({
label: "Unlimited Invitation Usages",
value: this.invitation.unlimited,
},
live_tv: {
label: "Access to Live TV",
value: this.invitation.live_tv,
},
},
emby: {
unlimited: {
label: "Unlimited Invitation Usages",
value: this.invitation.unlimited,
},
live_tv: {
label: "Access to Live TV",
value: this.invitation.live_tv,
},
},
plex: {
unlimited: {
Expand Down
1 change: 1 addition & 0 deletions apps/wizarr-frontend/src/types/api/invitations.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ export interface Invitation {
id: number;
plex_allow_sync: boolean;
plex_home: boolean;
live_tv: boolean;
sessions: number;
specific_libraries: string;
unlimited: boolean;
Expand Down

0 comments on commit 8723d1c

Please sign in to comment.