Repo created

This commit is contained in:
Fr4nz D13trich 2025-11-24 08:22:15 +01:00
parent 5b950caea0
commit 477d1afe74
805 changed files with 316919 additions and 2 deletions

1
tools/jenkins/README Normal file
View file

@ -0,0 +1 @@
This directory holds tools for continuous integration building via jenkins atm.

View file

@ -0,0 +1,4 @@
WORKSPACE=${WORKSPACE:-$( cd $(dirname $0)/../../.. ; pwd -P )}
export ANDROID_HOME=$SDK_PATH_KORE
cd $WORKSPACE;./gradlew assembleRelease

View file

@ -0,0 +1,56 @@
WORKSPACE=${WORKSPACE:-$( cd $(dirname $0)/../../.. ; pwd -P )}
# Signing done by Gradle, no need to run separate sign step
#$RUN_SIGNSTEP
function getBranchName ()
{
local branchName
branchName=`git symbolic-ref HEAD 2>/dev/null || echo detached`
if [ "$branchName" != "detached" ] # if we are not detached
then
#we are attached - use the branchname then
if echo $branchName | grep pr 2>&1 > /dev/null
then
#if this is a pull request branch - fetch the pr number and prefix with "PR"
#refs/heads/number/head
echo PR$(echo $branchName | awk '{gsub(".*/pr/","");print $1}' | awk '{gsub("/.*","");print $1}')
else
#if we are on a normal branch - fetch branchname
#refs/heads/branchname
echo $branchName | awk '{gsub(".*/","");print $1}'
fi
else
#if we are in detached head state
#fetch the first non-pullrequest branch we can find with HEAD
#also only grep in remotes that match current GITHUB_REPO
git branch -r --contains HEAD | sed "/origin\/pr\//d" | grep $GITHUB_REPO | head -n1 | awk '{gsub(".*/","");print $1}'
fi
}
function getBuildRevDateStr ()
{
local revStr
#fetch date-rev
revStr=`git --no-pager log --abbrev=7 -n 1 --pretty=format:"%h %ci" HEAD | awk '{gsub("-", "");print $2"-"$1}' 2>/dev/null`
if [ "$?" == "0" ]
then
#fetch the first branch containing head
revStr=$revStr"-"$(getBranchName)
if [ "$?" == "0" ]
then
echo $revStr
else
echo "Unknown"
fi
else
echo "Unknown"
fi
}
#rename for upload
#e.x. kore-20130314-8c2fb31.apk.
UPLOAD_FILENAME="kore-$(getBuildRevDateStr).apk"
cd $WORKSPACE;mv app/build/outputs/apk/release/app-release.apk $UPLOAD_FILENAME

1
tools/json/.gitignore vendored Normal file
View file

@ -0,0 +1 @@
*.json

52
tools/json/JsonTools.pm Normal file
View file

@ -0,0 +1,52 @@
#
# Copyright 2016 Martijn Brekhof. All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
package JsonTools;
use strict;
use warnings;
use Exporter qw(import);
use Cpanel::JSON::XS qw(encode_json decode_json);
use LWP::UserAgent;
our @EXPORT_OK = qw(sendJsonRequest writeJsonFile);
sub sendJsonRequest($$) {
my $url = shift;
my $json = shift;
my $jsonrequest = encode_json($json);
my $req = HTTP::Request->new( 'POST', $url );
$req->header( 'Content-Type' => 'application/json-rpc' );
$req->content( $jsonrequest );
my $ua = LWP::UserAgent->new;
my $response = $ua->request($req);
if (! $response->is_success) {
die $response->status_line;
}
return decode_json($response->decoded_content);
}
sub writeJsonFile($$) {
my $filename = shift;
my $json = shift;
open(FH, ">", $filename);
print FH Cpanel::JSON::XS->new->pretty(1)->encode($json);
close(FH);
}

27
tools/json/README.md Normal file
View file

@ -0,0 +1,27 @@
# JSON Tools
Here you will find perl scripts that can be used to retrieve JSON responses from a Kodi instance.
The scripts are primarily used to create the JSON source files needed by the instrumentation tests.
## Getting json responses
Currently there are two scripts available to get media details from a Kodi instance.
* `getmovies.pl`: retrieves movie details
* `getmusic.pl`: retrieves music details
By default the scripts connect to Kodi running on the same machine (`127.0.0.1`) on port `8080`.
If you need to contact a Kodi instance on a different port and/or IP-address change the
following line in each script:
```
my $url = "http://127.0.0.1:8080/jsonrpc";
```
## Generating test values
The instrumentation tests require some values such as "total number of songs", "list of artistids", "genre ids", etc. etc.
To generate these values from the JSON files, you can run
`gentestnumbers.pl`. This script expects the JSON files to be located in the same directory you execute the script.
It also assumes the names of the JSON files are the same as generated by `getmovies.pl` and `getmusic.pl`.

296
tools/json/gentestnumbers.pl Executable file
View file

@ -0,0 +1,296 @@
#!/usr/bin/perl
#
# Copyright 2016 Martijn Brekhof. All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
use strict;
use warnings;
use Cpanel::JSON::XS qw(encode_json decode_json);
sub printRanges($\@) {
my $key = shift;
my $arg = shift;
my $count = 0;
my @list = @{$arg};
my $current;
for (my $i = 1; $i < @list; $i++) {
$current = $list[$i]->{$key};
my $prev = $list[$i-1]->{$key};
if ( $current - $prev == 1 ) {
$count++;
} else {
if ( $count == 0 ) {
print $prev;
} else {
print $prev - $count . "-" . $prev;
}
print " ";
$count = 0;
}
}
if ( $count == 0 ) {
print $current if defined $current;
} else {
print $current - $count . "-" . $current;
}
}
sub decodeJson($) {
my $filename = shift;
local $/ = undef;
open (FH, $filename) or die "Error opening file $filename\n";
my $json_hash = decode_json(<FH>);
close FH;
return $json_hash;
}
sub printSong(\%) {
my $song = shift;
print "title: " . $song->{"title"} . "\n";
print "artistid: ";
for my $artistid ( @{$song->{"artistid"}} ) {
print $artistid . " ";
}
print "\n";
print "albumid: " . $song->{"albumid"} . "\n";
print "songid: " . $song->{"songid"} . "\n";
}
sub printAlbum(\%) {
my $album = shift;
print "title: " . $album->{"title"} . "\n";
print "albumid: " . $album->{"albumid"} . "\n";
print "displayartist: " . $album->{"displayartist"} . "\n";
print "year: " . $album->{"year"} . "\n";
print "genre: " . @{$album->{"genre"}} . "\n";
}
sub getArtists($) {
my $json_hash = shift;
return $json_hash->{"result"}->{"artists"};
}
sub getArtist($$) {
my $json_hash = shift;
my $artistid = shift;
my $artists = getArtists($json_hash);
for my $artist (@{$artists}) {
if ( $artistid == $artist->{"artistid"} ) {
return $artist;
}
}
return undef;
}
sub getAlbums($) {
my $json_hash = shift;
return $json_hash->{"result"}->{"albums"};
}
sub getAlbum($$) {
my $json_hash = shift;
my $albumid = shift;
my $albums = getAlbums($json_hash);
for my $album (@{$albums}) {
if ( $albumid == $album->{"albumid"}) {
return $album;
}
}
}
sub getAlbumsForGenre($$) {
my $json_hash = shift;
my $genreid = shift;
my @result;
my $albums = getAlbums($json_hash);
for my $album (@{$albums}) {
for my $albumGenreId (@{$album->{"genreid"}}) {
if ( $albumGenreId == $genreid ) {
push @result, $album;
}
}
}
return @result;
}
sub getSongs(%) {
my $json_hash = shift;
return $json_hash->{"result"}->{"songs"};
}
sub getSong(\%$) {
my $json_hash = shift;
my $songid = shift;
my $songs = getSongs($json_hash);
for my $song (@{$songs}) {
if ( $songid == $song->{"songid"}) {
return $song;
}
}
}
sub printArtistTestNumbers($) {
my $artistid = shift;
my $json_hash = decodeJson( "AudioLibrary.GetArtists.json" );
my $result = getArtists($json_hash);
print "Amount of artists: ", scalar @{$result}, "\n\n";
print "Artist ids: ";
my @artists = sort {$a->{"artistid"} <=> $b->{"artistid"}} @{$result};
printRanges("artistid", @artists);
print "\n\n";
print "Artist with artistId $artistid\n";
my $artist = getArtist($json_hash, $artistid);
print "artist: " . $artist->{"artist"} . "\n";
print "artistid: " . $artist->{"artistid"} . "\n";
print "\n\n";
}
sub printAlbumTestNumbers($$) {
my $albumid = shift;
my $genreid = shift;
my $json_hash = decodeJson( "AudioLibrary.GetAlbums.json" );
my $result = getAlbums($json_hash);
print "Amount of albums: ", scalar @{$result}, "\n\n";
print "Album ids: ";
my @albums = sort {$a->{"albumid"} <=> $b->{"albumid"}} @{$result};
printRanges("albumid", @albums);
print "\n\n";
print "Albums for genre id $genreid: ";
my @result = getAlbumsForGenre( $json_hash, $genreid );
@albums = sort {$a->{"albumid"} <=> $b->{"albumid"}} @result;
printRanges("albumid", @albums);
print "\n\n";
print "Album with albumId $albumid\n";
my $album = getAlbum($json_hash, $albumid);
printAlbum(%$album);
print "\n\n";
}
sub printSongTestNumbers(\@) {
my $songids = shift;
print "Amount of songs: ", scalar @{$songids}, "\n\n";
print "Song ids: ";
my @songs = sort {$a->{"songid"} <=> $b->{"songid"}} @{$songids};
printRanges("songid", @songs);
print "\n\n";
}
sub printArtistSongsTestNumbers(\@$) {
my $songids = shift;
my $artistid = shift;
my @songsforartist;
for my $song (@{$songids}) {
for my $id (@{$song->{"artistid"}}) {
if ( $id == $artistid ) {
push @songsforartist, $song;
}
}
}
print "Songs for artistid " . $artistid . ": total=" . scalar @songsforartist . ": ids=";
printRanges("songid", @songsforartist);
print "\n";
}
sub printAlbumSongsTestNumbers(\@$) {
my $songids = shift;
my $albumid = shift;
my @songsforalbum;
for my $song (@{$songids}) {
if ( $song->{"albumid"} == $albumid ) {
push @songsforalbum, $song;
}
}
print "Songs for albumid " . $albumid . ": total=" . scalar @songsforalbum . ": ids=";
printRanges("songid", @songsforalbum);
print "\n";
}
sub printSongCornerCases() {
my $json_hash = decodeJson( "AudioLibrary.GetSongs.json" );
print "Song with album and artist\n";
my $song = getSong(%$json_hash, 1487);
printSong(%$song);
print "\n\n";
print "Songs with album but without artist\n";
$song = getSong(%$json_hash, 1219);
printSong(%$song);
print "\n\n";
print "Song without album but with artist\n";
$song = getSong(%$json_hash, 1128);
printSong(%$song);
print "\n\n";
print "Song with multiple artists\n";
$song = getSong(%$json_hash, 1804);
printSong(%$song);
}
sub printAlbumCornerCases() {
my $json_hash = decodeJson( "AudioLibrary.GetAlbums.json" );
print "Album without an artist\n";
my $album = getAlbum($json_hash, 82);
printAlbum(%$album);
print "\n\n";
print "Album with multiple artists\n";
$album = getAlbum($json_hash, 234);
printAlbum(%$album);
print "\n\n";
}
printArtistTestNumbers(13);
printAlbumTestNumbers(13, 13);
printAlbumCornerCases();
my $json_hash = decodeJson( "AudioLibrary.GetSongs.json" );
my $result = getSongs($json_hash);
printSongTestNumbers(@{$result});
printArtistSongsTestNumbers(@{$result}, 232);
printAlbumSongsTestNumbers(@{$result}, 237);
print "\n\n";
printSongCornerCases();

53
tools/json/getaddons.pl Executable file
View file

@ -0,0 +1,53 @@
#!/usr/bin/perl
#
# Copyright 2017 Martijn Brekhof. All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
use strict;
use warnings;
use Types::Serialiser;
use JsonTools qw(sendJsonRequest writeJsonFile);
sub getAddons() {
my $jsonrequest = {
"jsonrpc" => "2.0",
"method" => "Addons.GetAddons",
"params" => {
"properties" => [
"name",
"version",
"summary",
"description",
"path",
"author",
"thumbnail",
"disclaimer",
"fanart",
"dependencies",
"broken",
"extrainfo",
"rating",
"enabled",
"installed"
],
},
"id" => "libAddons"
};
return sendJsonRequest("http://127.0.0.1:8080/jsonrpc", $jsonrequest);
}
writeJsonFile("Addons.GetAddons.json", getAddons);

73
tools/json/getmovies.pl Executable file
View file

@ -0,0 +1,73 @@
#!/usr/bin/perl
#
# Copyright 2016 Martijn Brekhof. All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
use strict;
use warnings;
use Types::Serialiser;
use JsonTools qw(sendJsonRequest writeJsonFile);
sub getMovies() {
my $jsonrequest = {
"jsonrpc" => "2.0",
"method" => "VideoLibrary.GetMovies",
"params" => {
"limits" => { "start" => 0, "end" => 300 },
"properties" => [
"title",
"genre",
"year",
"rating",
"director",
"trailer",
"tagline",
"plot",
"plotoutline",
"originaltitle",
"lastplayed",
"playcount",
"writer",
"studio",
"mpaa",
"cast",
"country",
"imdbnumber",
"runtime",
"set",
"showlink",
"streamdetails",
"top250",
"votes",
"fanart",
"thumbnail",
"file",
"sorttitle",
"resume",
"setid",
"dateadded",
"tag",
"art"
],
"sort" => { "order" => "ascending", "method" => "label", "ignorearticle" => Types::Serialiser::true }
},
"id" => "libMovies"
};
return sendJsonRequest("http://127.0.0.1:8080/jsonrpc", $jsonrequest);
}
writeJsonFile("Video.Details.Movie.json", getMovies);

191
tools/json/getmusic.pl Executable file
View file

@ -0,0 +1,191 @@
#!/usr/bin/perl
#
# Copyright 2016 Martijn Brekhof. All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
use strict;
use warnings;
use Types::Serialiser;
use JsonTools qw(sendJsonRequest writeJsonFile);
use Data::Dumper;
my $url = "http://127.0.0.1:8080/jsonrpc";
sub getSongs($) {
my $artist = shift;
my $jsonrequest = {
"jsonrpc" => "2.0",
"method" => "AudioLibrary.GetSongs",
"params" => {
"properties" => [
"title",
"artist",
"albumartist",
"genre",
"year",
"rating",
"album",
"track",
"duration",
"comment",
"lyrics",
"musicbrainztrackid",
"musicbrainzartistid",
"musicbrainzalbumid",
"musicbrainzalbumartistid",
"playcount",
"fanart",
"thumbnail",
"file",
"albumid",
"lastplayed",
"disc",
"genreid",
"artistid",
"displayartist",
"albumartistid"
],
"sort" => { "order" => "ascending", "method" => "label", "ignorearticle" => Types::Serialiser::true }
},
"id" => "libSongs",
};
if ( defined $artist ) {
$jsonrequest->{"params"}{"filter"} = {
"field" => "artist",
"operator" => "is",
"value" => [ $artist ]
};
}
return sendJsonRequest($url, $jsonrequest);
}
sub getArtists() {
my $jsonrequest = {
"jsonrpc" => "2.0",
"method" => "AudioLibrary.GetArtists",
"params" => {
"limits" => { "start" => 0, "end" => 300 },
"properties" => [
"instrument",
"style",
"mood",
"born",
"formed",
"description",
"genre",
"died",
"disbanded",
"yearsactive",
"musicbrainzartistid",
"fanart",
"thumbnail"
],
"sort" => { "order" => "ascending", "method" => "label", "ignorearticle" => Types::Serialiser::true }
},
"id" => "libArtists"
};
return sendJsonRequest($url, $jsonrequest);
}
sub getGenres() {
my $jsonrequest = {
"jsonrpc" => "2.0",
"method" => "AudioLibrary.GetGenres",
"params" => {
"properties" => [
"title",
"thumbnail"
],
"sort" => { "order" => "ascending", "method" => "label", "ignorearticle" => Types::Serialiser::true }
},
"id" => "libGenres"
};
return sendJsonRequest($url, $jsonrequest);
}
sub getAlbums($) {
my $artistid = shift;
my $jsonrequest = {
"jsonrpc" => "2.0",
"method" => "AudioLibrary.GetAlbums",
"params" => {
"properties" => [
"title",
"description",
"artist",
"genre",
"theme",
"mood",
"style",
"type",
"albumlabel",
"rating",
"year",
"musicbrainzalbumid",
"musicbrainzalbumartistid",
"fanart",
"thumbnail",
"playcount",
"genreid",
"artistid",
"displayartist"
],
"sort" => { "order" => "ascending", "method" => "label", "ignorearticle" => Types::Serialiser::true }
},
"id" => "libAlbums"
};
if ( defined $artistid ) {
$jsonrequest->{"params"}->{"filter"}->{"artistid"} = $artistid;
}
return sendJsonRequest($url, $jsonrequest);
}
writeJsonFile("AudioLibrary.GetGenres.json", getGenres());
my $artists = getArtists();
writeJsonFile("AudioLibrary.GetArtists.json", $artists);
my $json_albums;
my %albums_seen; #Need to filter out duplicates of various artist albums
my $count = 0;
for my $artist (@{$artists->{"result"}->{"artists"}}) {
my $albums = getAlbums($artist->{"artistid"});
if ( ! defined $json_albums ) {
$count = 1;
$json_albums = $albums;
} else {
for my $album (@{$albums->{"result"}->{"albums"}}) {
my $albumid = $album->{"albumid"};
if ( ! exists $albums_seen{$albumid} ) {
$count++;
push $json_albums->{"result"}->{"albums"}, $album;
$albums_seen{$albumid} = "";
}
}
}
}
$json_albums->{"result"}{"limits"} = {"end" => $count, "start" => 0, "total" => $count};
writeJsonFile("AudioLibrary.GetAlbums.json", $json_albums);
writeJsonFile("AudioLibrary.GetSongs.json", getSongs(undef));

63
tools/json/getmusicvideos.pl Executable file
View file

@ -0,0 +1,63 @@
#!/usr/bin/perl
#
# Copyright 2017 Martijn Brekhof. All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
use strict;
use warnings;
use Types::Serialiser;
use JsonTools qw(sendJsonRequest writeJsonFile);
sub getMusicVideos() {
my $jsonrequest = {
"jsonrpc" => "2.0",
"method" => "VideoLibrary.GetMusicVideos",
"params" => {
"limits" => { "start" => 0, "end" => 10 },
"properties" => [
"title",
"playcount",
"runtime",
"director",
"studio",
"year",
"plot",
"album",
"artist",
"genre",
"track",
"streamdetails",
"lastplayed",
"fanart",
"thumbnail",
"file",
"resume",
"dateadded",
"tag",
"art",
"rating",
"userrating",
"premiered"
],
"sort" => { "order" => "ascending", "method" => "label", "ignorearticle" => Types::Serialiser::true }
},
"id" => "libMovies"
};
return sendJsonRequest("http://127.0.0.1:8080/jsonrpc", $jsonrequest);
}
writeJsonFile("VideoLibrary.GetMusicVideos.json", getMusicVideos);

181
tools/json/gettvshows.pl Executable file
View file

@ -0,0 +1,181 @@
#!/usr/bin/perl
#
# Copyright 2017 Martijn Brekhof. All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
use strict;
use warnings;
use Types::Serialiser;
use JsonTools qw(sendJsonRequest writeJsonFile);
sub getTVShows() {
my $jsonrequest = {
"jsonrpc" => "2.0",
"method" => "VideoLibrary.GetTVShows",
"params" => {
"limits" => { "start" => 0, "end" => 10 },
"properties" => [
"title",
"genre",
"year",
"rating",
"plot",
"studio",
"mpaa",
"cast",
"playcount",
"episode",
"imdbnumber",
"premiered",
"votes",
"lastplayed",
"fanart",
"thumbnail",
"file",
"originaltitle",
"sorttitle",
"episodeguide",
"season",
"watchedepisodes",
"dateadded",
"tag",
"art",
"userrating",
"ratings",
"runtime",
"uniqueid"
],
"sort" => { "order" => "ascending", "method" => "label", "ignorearticle" => Types::Serialiser::true }
},
"id" => "libTVShows"
};
return sendJsonRequest("http://127.0.0.1:8080/jsonrpc", $jsonrequest);
}
sub getSeasons($) {
my $tvshowid = shift;
my $jsonrequest = {
"jsonrpc" => "2.0",
"method" => "VideoLibrary.GetSeasons",
"params" => {
"tvshowid" => $tvshowid,
"properties" => [
"season",
"showtitle",
"playcount",
"episode",
"fanart",
"thumbnail",
"tvshowid",
"watchedepisodes",
"art",
"userrating"
],
"sort" => { "order" => "ascending", "method" => "label", "ignorearticle" => Types::Serialiser::true }
},
"id" => "libTVShowSeasons"
};
return sendJsonRequest("http://127.0.0.1:8080/jsonrpc", $jsonrequest);
}
sub getEpisodes($) {
my $tvshowid = shift;
my $jsonrequest = {
"jsonrpc" => "2.0",
"method" => "VideoLibrary.GetEpisodes",
"params" => {
"tvshowid" => $tvshowid,
"properties" => [
"title",
"plot",
"votes",
"rating",
"writer",
"firstaired",
"playcount",
"runtime",
"director",
"productioncode",
"season",
"episode",
"originaltitle",
"showtitle",
"cast",
"streamdetails",
"lastplayed",
"fanart",
"thumbnail",
"file",
"resume",
"tvshowid",
"dateadded",
"uniqueid",
"art",
"specialsortseason",
"specialsortepisode",
"userrating",
"seasonid",
"ratings"
],
"sort" => { "order" => "ascending", "method" => "label", "ignorearticle" => Types::Serialiser::true }
},
"id" => "libTVShowEpisodes"
};
return sendJsonRequest("http://127.0.0.1:8080/jsonrpc", $jsonrequest);
}
my $tvshows_list = getTVShows();
my $json_seasons;
my $json_episodes;
for my $tvshow (@{$tvshows_list->{"result"}->{"tvshows"}}) {
my $seasons_list = getSeasons($tvshow->{"tvshowid"});
if (! defined $json_seasons) {
$json_seasons = $seasons_list;
} else {
for my $season ( @{$seasons_list->{"result"}->{"seasons"}} ) {
push $json_seasons->{"result"}->{"seasons"}, $season;
}
}
my $episodes_list = getEpisodes($tvshow->{"tvshowid"});
if (! defined $json_episodes) {
$json_episodes = $episodes_list;
} else {
for my $episode ( @{$episodes_list->{"result"}->{"episodes"}} ) {
push $json_episodes->{"result"}->{"episodes"}, $episode;
}
}
}
writeJsonFile("VideoLibrary.GetTVShows.json", $tvshows_list);
my $count = length($json_seasons->{"result"}->{"seasons"});
$json_seasons->{"result"}{"limits"} = {"end" => $count, "start" => 0, "total" => $count};
writeJsonFile("VideoLibrary.GetSeasons.json", $json_seasons);
$count = length($json_episodes->{"result"}->{"episodes"});
$json_seasons->{"result"}{"limits"} = {"end" => $count, "start" => 0, "total" => $count};
writeJsonFile("VideoLibrary.GetEpisodes.json", $json_episodes);