Added the ability to change where the View on Emby link goes to #2730

pull/2754/head
TidusJar 6 years ago
parent 732873acda
commit 1f59693c7e

@ -7,11 +7,16 @@ namespace Ombi.Helpers
{
public class EmbyHelper
{
public static string GetEmbyMediaUrl(string mediaId)
public static string GetEmbyMediaUrl(string mediaId, string customerServerUrl = null)
{
var url =
$"http://app.emby.media/#!/itemdetails.html?id={mediaId}";
return url;
if (customerServerUrl.HasValue())
{
return $"{customerServerUrl}#!/itemdetails.html?id={mediaId}";
}
else
{
return $"https://app.emby.media/#!/itemdetails.html?id={mediaId}";
}
}
}
}

@ -87,7 +87,7 @@ namespace Ombi.Schedule.Jobs.Emby
await _api.GetCollection(movie.Id, server.ApiKey, server.AdministratorId, server.FullUri);
foreach (var item in movieInfo.Items)
{
await ProcessMovies(item, mediaToAdd);
await ProcessMovies(item, mediaToAdd, server);
}
processed++;
@ -96,7 +96,7 @@ namespace Ombi.Schedule.Jobs.Emby
{
processed++;
// Regular movie
await ProcessMovies(movie, mediaToAdd);
await ProcessMovies(movie, mediaToAdd, server);
}
}
@ -138,7 +138,7 @@ namespace Ombi.Schedule.Jobs.Emby
Title = tvShow.Name,
Type = EmbyMediaType.Series,
EmbyId = tvShow.Id,
Url = EmbyHelper.GetEmbyMediaUrl(tvShow.Id),
Url = EmbyHelper.GetEmbyMediaUrl(tvShow.Id, server.ServerHostname),
AddedAt = DateTime.UtcNow
});
}
@ -164,7 +164,7 @@ namespace Ombi.Schedule.Jobs.Emby
await _repo.AddRange(mediaToAdd);
}
private async Task ProcessMovies(EmbyMovie movieInfo, ICollection<EmbyContent> content)
private async Task ProcessMovies(EmbyMovie movieInfo, ICollection<EmbyContent> content, EmbyServers server)
{
// Check if it exists
var existingMovie = await _repo.GetByEmbyId(movieInfo.Id);
@ -179,7 +179,7 @@ namespace Ombi.Schedule.Jobs.Emby
Title = movieInfo.Name,
Type = EmbyMediaType.Movie,
EmbyId = movieInfo.Id,
Url = EmbyHelper.GetEmbyMediaUrl(movieInfo.Id),
Url = EmbyHelper.GetEmbyMediaUrl(movieInfo.Id, server.ServerHostname),
AddedAt = DateTime.UtcNow,
});
}

@ -14,6 +14,7 @@ namespace Ombi.Core.Settings.Models.External
public string Name { get; set; }
public string ApiKey { get; set; }
public string AdministratorId { get; set; }
public string ServerHostname { get; set; }
public bool EnableEpisodeSearching { get; set; }
}
}

@ -41,6 +41,7 @@ export interface IEmbyServer extends IExternalSettings {
apiKey: string;
administratorId: string;
enableEpisodeSearching: boolean;
serverHostname: string;
}
export interface IPlexSettings extends ISettings {

@ -63,6 +63,18 @@
<input type="text" class="form-control-custom form-control" id="authToken" [(ngModel)]="server.apiKey" placeholder="Emby Api Key" value="{{server.apiKey}}">
</div>
</div>
<div class="form-group">
<label for="authToken" class="control-label">Externally Facing Hostname
<i class="fa fa-question-circle"
pTooltip="This will be the external address that users will naviagte to when they press the 'View On Emby' button"></i>
</label>
<div>
<input type="text" class="form-control-custom form-control" id="authToken" [(ngModel)]="server.serverHostname" placeholder="e.g. https://jellyfin.server.com/" value="{{server.serverHostname}}">
<small><span *ngIf="server.serverHostname">Current URL: "{{server.serverHostname}}/#!/itemdetails.html?id=1"</span>
<span *ngIf="!server.serverHostname">Current URL: "https://app.emby.media/#!/itemdetails.html?id=1</span></small>
</div>
</div>
<div class="form-group">
<div>
<button id="testEmby" type="button" (click)="test(server)" class="btn btn-primary-outline">Test Connectivity <div id="spinner"></div></button>

@ -41,6 +41,7 @@ export class EmbyComponent implements OnInit {
port: 8096,
ssl: false,
subDir: "",
serverHostname: "",
});
}

Loading…
Cancel
Save