Skip to content

Commit

Permalink
add support for jellyfin
Browse files Browse the repository at this point in the history
upgrade to java 14
  • Loading branch information
lamarios committed Jul 25, 2020
1 parent 4f09c86 commit 610a627
Show file tree
Hide file tree
Showing 40 changed files with 530 additions and 302 deletions.
2 changes: 1 addition & 1 deletion models/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
<parent>
<groupId>com.ftpix.homedash</groupId>
<artifactId>homedash</artifactId>
<version>2019.07.1</version>
<version>2020.1</version>
</parent>

<artifactId>models</artifactId>
Expand Down
2 changes: 1 addition & 1 deletion notifications/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<parent>
<artifactId>homedash</artifactId>
<groupId>com.ftpix.homedash</groupId>
<version>2019.07.1</version>
<version>2020.1</version>
</parent>
<modelVersion>4.0.0</modelVersion>

Expand Down
2 changes: 1 addition & 1 deletion plugins/couchpotato/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
<parent>
<groupId>com.ftpix.homedash.plugins</groupId>
<artifactId>plugins</artifactId>
<version>2019.07.1</version>
<version>2020.1</version>
</parent>

<artifactId>couchpotato</artifactId>
Expand Down
2 changes: 1 addition & 1 deletion plugins/docker/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
<parent>
<groupId>com.ftpix.homedash.plugins</groupId>
<artifactId>plugins</artifactId>
<version>2019.07.1</version>
<version>2020.1</version>
</parent>

<artifactId>docker</artifactId>
Expand Down
2 changes: 1 addition & 1 deletion plugins/dockercompose/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<parent>
<artifactId>plugins</artifactId>
<groupId>com.ftpix.homedash.plugins</groupId>
<version>2019.07.1</version>
<version>2020.1</version>
</parent>
<modelVersion>4.0.0</modelVersion>

Expand Down
2 changes: 1 addition & 1 deletion plugins/dynamicdns/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
<parent>
<groupId>com.ftpix.homedash.plugins</groupId>
<artifactId>plugins</artifactId>
<version>2019.07.1</version>
<version>2020.1</version>
</parent>

<artifactId>dynamicdns</artifactId>
Expand Down
2 changes: 1 addition & 1 deletion plugins/googlepubliccalendar/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
<parent>
<groupId>com.ftpix.homedash.plugins</groupId>
<artifactId>plugins</artifactId>
<version>2019.07.1</version> </parent>
<version>2020.1</version> </parent>

<artifactId>googlepubliccalendar</artifactId>
<name>googlepubliccalendar</name>
Expand Down
2 changes: 1 addition & 1 deletion plugins/harddisk/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
<parent>
<groupId>com.ftpix.homedash.plugins</groupId>
<artifactId>plugins</artifactId>
<version>2019.07.1</version>
<version>2020.1</version>
</parent>

<artifactId>harddisk</artifactId>
Expand Down
2 changes: 1 addition & 1 deletion plugins/kvm/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<parent>
<artifactId>plugins</artifactId>
<groupId>com.ftpix.homedash.plugins</groupId>
<version>2019.07.1</version>
<version>2020.1</version>
</parent>
<modelVersion>4.0.0</modelVersion>

Expand Down
2 changes: 1 addition & 1 deletion plugins/logreader/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<parent>
<artifactId>plugins</artifactId>
<groupId>com.ftpix.homedash.plugins</groupId>
<version>2019.07.1</version>
<version>2020.1</version>
</parent>
<modelVersion>4.0.0</modelVersion>

Expand Down
2 changes: 1 addition & 1 deletion plugins/mma/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
<parent>
<groupId>com.ftpix.homedash.plugins</groupId>
<artifactId>plugins</artifactId>
<version>2019.07.1</version> </parent>
<version>2020.1</version> </parent>

<artifactId>mma</artifactId>
<name>mma</name>
Expand Down
2 changes: 1 addition & 1 deletion plugins/networkmonitor/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
<parent>
<groupId>com.ftpix.homedash.plugins</groupId>
<artifactId>plugins</artifactId>
<version>2019.07.1</version>
<version>2020.1</version>
</parent>

<artifactId>networkmonitor</artifactId>
Expand Down
2 changes: 1 addition & 1 deletion plugins/pihole/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
<parent>
<groupId>com.ftpix.homedash.plugins</groupId>
<artifactId>plugins</artifactId>
<version>2019.07.1</version> </parent>
<version>2020.1</version> </parent>

<artifactId>pihole</artifactId>
<name>pihole</name>
Expand Down
2 changes: 1 addition & 1 deletion plugins/plex/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
<parent>
<groupId>com.ftpix.homedash.plugins</groupId>
<artifactId>plugins</artifactId>
<version>2019.07.1</version>
<version>2020.1</version>
</parent>

<artifactId>plex</artifactId>
Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
36 changes: 8 additions & 28 deletions plugins/plex/src/main/java/assets/js/plex.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,51 +12,31 @@ function plex(moduleId) {

this.onMessage = function (size, command, message, extra) {


var root = rootElement(this.moduleId);
if (message.size == '0') {
root.addClass(message.type);
if (message.videos === undefined || message.videos.length === 0) {
root.find('.now-playing').addClass('nothing');
} else {
var video;
if (message.size == 1) {
if (message.videos.length === 1) {
video = message.videos[0];
} else {
this.currentIndex++;
if (message.size > this.currentIndex) {
if (message.videos.size > this.currentIndex) {
video = message.videos[this.currentIndex];
} else {
video = message.videos[0];
this.currentIndex = 0;
}
}

var name = '', art = video.art;
if (video.type == "episode") {
if (video.grandparentTitle != '') {
name = video.grandparentTitle + ' - ';
}
if (video.parentTitle != '') {
name += video.parentTitle + ' - ';
}
name += video.title;

if(video.grandparentArt != ''){
art = video.grandparentArt;
}
}else{
name = video.title;
}

var progress = (video.viewOffset / video.duration)*100;

var nowPlaying = root.find('.now-playing');
nowPlaying.removeClass('nothing');
nowPlaying.css('background-image', "url('" + art + "')");
nowPlaying.find('.name').html(name);
nowPlaying.find('.progress').css('width', progress+'%');
nowPlaying.find('.player').html(video.player.title);
nowPlaying.css('background-image', "url('" + video.image + "')");
nowPlaying.find('.name').html(video.name);
nowPlaying.find('.progress').css('width', video.progress + '%');
nowPlaying.find('.player').html(video.player);
}
}


}
56 changes: 38 additions & 18 deletions plugins/plex/src/main/java/assets/less/plex.less
Original file line number Diff line number Diff line change
@@ -1,8 +1,28 @@
.plex {
background: #333 url('../files/images/icon.svg');
background-size: cover;
background-position: center center;
background-repeat: no-repeat;
background-color: #000;

&.PLEX {
background-color: #333;
background-image: url('../files/images/plex.svg');

.progress{
background: rgb(206, 125, 1);
}
}

&.JELLYFIN {
background-color: #000;
background-image: url('../files/images/jellyfin.png');
background-size: contain;

.progress{
background: rgb(26, 158, 224);
}
}


.now-playing {
position: absolute;
Expand All @@ -22,6 +42,7 @@
background-size: cover;
background-position: center center;


.info {
background: rgba(0, 0, 0, 0.5);
position: absolute;
Expand All @@ -31,11 +52,10 @@


.progress {
background: rgb(206, 125, 1);
height: 5px;
margin: 0;
@progressSpeed:0.25s;

@progressSpeed: 0.25s;
-webkit-transition: width @progressSpeed;
-moz-transition: width @progressSpeed;
-ms-transition: width @progressSpeed;
Expand All @@ -45,14 +65,14 @@

.name {
padding: 5px;
color:white;
color: white;
font-size: 20px;
}

.player{
.player {
padding: 5px;
text-align: right;
color:white;
color: white;
}

}
Expand All @@ -63,38 +83,38 @@
}
}

.plex.size-2x1{
.name{
.plex.size-2x1 {
.name {
font-size: 15px !important;
}

.player{
.player {
display: none;
}
}

.plex.size-1x1{
.info{
.name{
.plex.size-1x1 {
.info {
.name {
display: none;
}

.player{
.player {
display: none;
}
}
}

.plex.size-kiosk{
.progress{
.plex.size-kiosk {
.progress {
height: 1vh !important;
}

.name{
.name {
font-size: 5vh !important;
}

.player{
.player {
font-size: 3vh !important;
}
}
51 changes: 39 additions & 12 deletions plugins/plex/src/main/java/assets/templates/plex-settings.jade
Original file line number Diff line number Diff line change
@@ -1,16 +1,43 @@
.form-group
label(for="url") Plex server address
label(for="type") API Type
select.form-control(name="type", id="type")
each type, index in {'PLEX':'Plex', 'JELLYFIN':'Jellyfin'}
if settings && settings.containsKey("type") && settings.get("type").equalsIgnoreCase(index)
option(value=index, selected=true)= type
else
option(value=index)= type
.form-group
label(for="url") Server address
if settings && settings.containsKey("url")
input.form-control(type="text", id="url", name="url", placeholder="URL", value='#{settings.get("url")}')
input.form-control(type="text", id="url", name="url", placeholder="https://jellifinserver.com:8096", value='#{settings.get("url")}')
else
input.form-control(type="text", id="url", name ="url", placeholder = "URL")
input.form-control(type="text", id="url", name ="url", placeholder = "https://jellifinserver.com:8096")
#PLEX.media-server
.form-group
label(for="token")
| Authentication token (
a(href="https://support.plex.tv/hc/en-us/articles/204059436-Finding-an-authentication-token-X-Plex-Token") get authentication token
| )
if settings && settings.containsKey("token")
input.form-control(type="text", id="token", name="token", placeholder="Token", value='#{settings.get("token")}')
else
input.form-control(type="text", id="token", name ="token", placeholder = "Token")
#JELLYFIN.media-server
.form-group
label(for="apiKey") Api key
if settings && settings.containsKey("apiKey")
input.form-control(type="text", id="apiKey", name="apiKey", placeholder="Api key", value='#{settings.get("apiKey")}')
else
input.form-control(type="text", id="apiKey", name ="apiKey", placeholder = "Api key")

.form-group
label(for="token")
| Authentication token (
a(href="https://support.plex.tv/hc/en-us/articles/204059436-Finding-an-authentication-token-X-Plex-Token") get authentication token
| )
if settings && settings.containsKey("token")
input.form-control(type="text", id="token", name="token", placeholder="Token", value='#{settings.get("token")}')
else
input.form-control(type="text", id="token", name ="token", placeholder = "Token")
script(type="text/javascript").
document.addEventListener("DOMContentLoaded", function() {

function toggleSettings(){
$('.media-server').hide();
$('#'+$('#type').val()).show();
}

$('#type').change(toggleSettings);
toggleSettings();
});
Loading

0 comments on commit 610a627

Please sign in to comment.