sync model

This commit is contained in:
Luke Pulverenti 2015-03-27 13:46:07 -04:00
parent f0adfd908b
commit 0e2439d144
31 changed files with 845 additions and 737 deletions

772
.idea/workspace.xml generated

File diff suppressed because it is too large Load Diff

View File

@ -61,6 +61,8 @@ public class AndroidApiClient extends ApiClient {
@Override
public void getResponseStream(final String address, final Response<InputStream> response){
Logger.Debug("Getting response stream from " + address);
new AsyncTask(){
@Override

Binary file not shown.

View File

@ -31,7 +31,7 @@ import mediabrowser.model.globalization.CountryInfo;
import mediabrowser.model.globalization.CultureDto;
import mediabrowser.model.livetv.*;
import mediabrowser.model.logging.ILogger;
import mediabrowser.model.mediainfo.LiveMediaInfoResult;
import mediabrowser.model.mediainfo.PlaybackInfoResponse;
import mediabrowser.model.net.HttpException;
import mediabrowser.model.notifications.NotificationQuery;
import mediabrowser.model.notifications.NotificationResult;
@ -183,6 +183,7 @@ public class ApiClient extends BaseApiClient {
public void getResponseStream(String address, Response<InputStream> response){
Logger.Debug("Getting response stream from " + address);
try
{
URL url = new URL(address);
@ -2360,7 +2361,7 @@ public class ApiClient extends BaseApiClient {
Send(url, "GET", new SerializedResponse<QueryFilters>(response, jsonSerializer, QueryFilters.class));
}
public void GetPlaybackInfo(String itemId, String userId, final Response<LiveMediaInfoResult> response)
public void GetPlaybackInfo(String itemId, String userId, final Response<PlaybackInfoResponse> response)
{
QueryStringDictionary dict = new QueryStringDictionary();
@ -2370,7 +2371,7 @@ public class ApiClient extends BaseApiClient {
url = AddDataFormat(url);
Send(url, "GET", new SerializedResponse<LiveMediaInfoResult>(response, jsonSerializer, LiveMediaInfoResult.class));
Send(url, "GET", new SerializedResponse<PlaybackInfoResponse>(response, jsonSerializer, PlaybackInfoResponse.class));
}
public void GetDevicesOptions(final Response<DevicesOptions> response)

View File

@ -30,7 +30,7 @@ public class ServerLocator implements IServerLocator {
DatagramSocket c = new DatagramSocket();
c.setBroadcast(true);
byte[] sendData = "who is MediaBrowserServer_v2?".getBytes();
byte[] sendData = "who is EmbyServer?".getBytes();
int port = 7359;

View File

@ -4,12 +4,12 @@ import mediabrowser.apiinteraction.Response;
import mediabrowser.model.dlna.PlaybackException;
import mediabrowser.model.dlna.StreamInfo;
import mediabrowser.model.dlna.VideoOptions;
import mediabrowser.model.mediainfo.LiveMediaInfoResult;
import mediabrowser.model.mediainfo.PlaybackInfoResponse;
/**
* Created by Luke on 3/24/2015.
*/
public class GetPlaybackInfoResponse extends Response<LiveMediaInfoResult> {
public class GetPlaybackInfoResponse extends Response<PlaybackInfoResponse> {
private PlaybackManager playbackManager;
private String serverId;
@ -25,7 +25,7 @@ public class GetPlaybackInfoResponse extends Response<LiveMediaInfoResult> {
}
@Override
public void onResponse(LiveMediaInfoResult playbackInfo) {
public void onResponse(PlaybackInfoResponse playbackInfo) {
if (playbackInfo.getErrorCode() != null){

View File

@ -446,7 +446,7 @@ public class LocalAssetManager implements ILocalAssetManager {
{
LocalItemQuery query = new LocalItemQuery();
query.setServerId(user.getServerId());
query.setAlbumArtist(parentItem.getName());
query.setAlbumArtistId(parentItem.getId());
query.setType("Audio");
ArrayList<LocalItem> items = itemRepository.getItems(query);

View File

@ -2,128 +2,134 @@ package mediabrowser.model.apiclient;
import mediabrowser.model.extensions.*;
import java.util.ArrayList;
import java.util.Date;
public class ServerCredentials
{
private java.util.ArrayList<ServerInfo> Servers;
public final java.util.ArrayList<ServerInfo> getServers()
{
return Servers;
}
public final void setServers(java.util.ArrayList<ServerInfo> value)
{
Servers = value;
}
private java.util.ArrayList<ServerInfo> Servers;
public final java.util.ArrayList<ServerInfo> getServers()
{
return Servers;
}
public final void setServers(java.util.ArrayList<ServerInfo> value)
{
Servers = value;
}
private String ConnectUserId;
public final String getConnectUserId()
{
return ConnectUserId;
}
public final void setConnectUserId(String value)
{
ConnectUserId = value;
}
private String ConnectAccessToken;
public final String getConnectAccessToken()
{
return ConnectAccessToken;
}
public final void setConnectAccessToken(String value)
{
ConnectAccessToken = value;
}
private String ConnectUserId;
public final String getConnectUserId()
{
return ConnectUserId;
}
public final void setConnectUserId(String value)
{
ConnectUserId = value;
}
private String ConnectAccessToken;
public final String getConnectAccessToken()
{
return ConnectAccessToken;
}
public final void setConnectAccessToken(String value)
{
ConnectAccessToken = value;
}
public ServerCredentials()
{
setServers(new java.util.ArrayList<ServerInfo>());
}
public ServerCredentials()
{
setServers(new java.util.ArrayList<ServerInfo>());
}
public final void AddOrUpdateServer(ServerInfo server)
{
if (server == null)
{
throw new IllegalArgumentException("server");
}
public final void AddOrUpdateServer(ServerInfo server)
{
if (server == null)
{
throw new IllegalArgumentException("server");
}
ArrayList<ServerInfo> list = new ArrayList<ServerInfo>();
list.addAll(getServers());
// Clone the existing list of servers
java.util.ArrayList<ServerInfo> list = new java.util.ArrayList<ServerInfo>();
for (ServerInfo serverInfo : getServers())
{
list.add(serverInfo);
}
int index = FindIndex(list, server.getId());
int index = FindIndex(list, server.getId());
if (index != -1)
{
ServerInfo existing = list.get(index);
if (index != -1)
{
ServerInfo existing = list.get(index);
// Merge the data
if (server.getDateLastAccessed().getTime() > existing.getDateLastAccessed().getTime()){
existing.setDateLastAccessed(server.getDateLastAccessed());
}
// Take the most recent DateLastAccessed
if (server.getDateLastAccessed().compareTo(existing.getDateLastAccessed()) > 0)
{
existing.setDateLastAccessed(server.getDateLastAccessed());
}
existing.setUserLinkType(server.getUserLinkType());
existing.setUserLinkType(server.getUserLinkType());
if (!tangible.DotNetToJavaStringHelper.isNullOrEmpty(server.getAccessToken()))
{
existing.setAccessToken(server.getAccessToken());
existing.setUserId(server.getUserId());
}
if (!tangible.DotNetToJavaStringHelper.isNullOrEmpty(server.getExchangeToken()))
{
existing.setExchangeToken(server.getExchangeToken());
}
if (!tangible.DotNetToJavaStringHelper.isNullOrEmpty(server.getRemoteAddress()))
{
existing.setRemoteAddress(server.getRemoteAddress());
}
if (!tangible.DotNetToJavaStringHelper.isNullOrEmpty(server.getLocalAddress()))
{
existing.setLocalAddress(server.getLocalAddress());
}
if (!tangible.DotNetToJavaStringHelper.isNullOrEmpty(server.getManualAddress()))
{
existing.setManualAddress(server.getManualAddress());
}
if (!tangible.DotNetToJavaStringHelper.isNullOrEmpty(server.getName()))
{
existing.setName(server.getName());
}
if (server.getWakeOnLanInfos() != null && server.getWakeOnLanInfos().size() > 0)
{
existing.getWakeOnLanInfos().clear();
existing.getWakeOnLanInfos().addAll(server.getWakeOnLanInfos());
}
if (server.getLastConnectionMode() != null){
existing.setLastConnectionMode(server.getLastConnectionMode());
}
if (!tangible.DotNetToJavaStringHelper.isNullOrEmpty(server.getAccessToken()))
{
existing.setAccessToken(server.getAccessToken());
existing.setUserId(server.getUserId());
}
if (!tangible.DotNetToJavaStringHelper.isNullOrEmpty(server.getExchangeToken()))
{
existing.setExchangeToken(server.getExchangeToken());
}
if (!tangible.DotNetToJavaStringHelper.isNullOrEmpty(server.getRemoteAddress()))
{
existing.setRemoteAddress(server.getRemoteAddress());
}
if (!tangible.DotNetToJavaStringHelper.isNullOrEmpty(server.getLocalAddress()))
{
existing.setLocalAddress(server.getLocalAddress());
}
if (!tangible.DotNetToJavaStringHelper.isNullOrEmpty(server.getManualAddress()))
{
existing.setLocalAddress(server.getManualAddress());
}
if (!tangible.DotNetToJavaStringHelper.isNullOrEmpty(server.getName()))
{
existing.setName(server.getName());
}
if (server.getWakeOnLanInfos() != null && server.getWakeOnLanInfos().size() > 0)
{
existing.setWakeOnLanInfos(new java.util.ArrayList<WakeOnLanInfo>());
for (WakeOnLanInfo info : server.getWakeOnLanInfos())
{
existing.getWakeOnLanInfos().add(info);
}
}
if (server.getLastConnectionMode() != null)
{
existing.setLastConnectionMode(server.getLastConnectionMode());
}
for (ServerUserInfo user : server.getUsers())
{
existing.AddOrUpdate(user);
}
}
else
{
list.add(server);
}
}
else
{
list.add(server);
}
setServers(list);
}
setServers(list);
}
private int FindIndex(ArrayList<ServerInfo> servers, String id)
{
int index = 0;
private int FindIndex(java.util.ArrayList<ServerInfo> servers, String id)
{
int index = 0;
for (ServerInfo server : servers)
{
if (StringHelper.EqualsIgnoreCase(id, server.getId()))
{
return index;
}
for (ServerInfo server : servers)
{
if (StringHelper.EqualsIgnoreCase(id, server.getId()))
{
return index;
}
index++;
}
index++;
}
return -1;
}
return -1;
}
}

View File

@ -183,7 +183,12 @@ public class ServerInfo
throw new IllegalArgumentException("user");
}
java.util.ArrayList<ServerUserInfo> list = getUsers();
// Clone the existing list of users
java.util.ArrayList<ServerUserInfo> list = new java.util.ArrayList<ServerUserInfo>();
for (ServerUserInfo serverUserInfo : getUsers())
{
list.add(serverUserInfo);
}
int index = FindIndex(list, user.getId());

View File

@ -98,6 +98,21 @@ public class ServerConfiguration extends BaseApplicationConfiguration
EnableHttps = value;
}
/**
Gets or sets a value indicating whether [enable user specific user views].
<value><c>true</c> if [enable user specific user views]; otherwise, <c>false</c>.</value>
*/
private boolean EnableUserSpecificUserViews;
public final boolean getEnableUserSpecificUserViews()
{
return EnableUserSpecificUserViews;
}
public final void setEnableUserSpecificUserViews(boolean value)
{
EnableUserSpecificUserViews = value;
}
/**
Gets or sets the value pointing to the file system where the ssl certiifcate is located..
@ -264,7 +279,7 @@ public class ServerConfiguration extends BaseApplicationConfiguration
}
/**
Characters to be replaced with a ' ' in strings to createUserAction a sort name
Characters to be replaced with a ' ' in strings to create a sort name
<value>The sort replace characters.</value>
*/
@ -279,7 +294,7 @@ public class ServerConfiguration extends BaseApplicationConfiguration
}
/**
Characters to be removed from strings to createUserAction a sort name
Characters to be removed from strings to create a sort name
<value>The sort remove characters.</value>
*/
@ -294,7 +309,7 @@ public class ServerConfiguration extends BaseApplicationConfiguration
}
/**
Words to be removed from strings to createUserAction a sort name
Words to be removed from strings to create a sort name
<value>The sort remove words.</value>
*/
@ -590,16 +605,6 @@ public class ServerConfiguration extends BaseApplicationConfiguration
EnableVideoArchiveFiles = value;
}
private boolean EnableLegacyCollections;
public final boolean getEnableLegacyCollections()
{
return EnableLegacyCollections;
}
public final void setEnableLegacyCollections(boolean value)
{
EnableLegacyCollections = value;
}
/**
Initializes a new instance of the <see cref="ServerConfiguration" /> class.
*/
@ -649,5 +654,81 @@ public class ServerConfiguration extends BaseApplicationConfiguration
setPeopleMetadataOptions(new PeopleMetadataOptions());
setInsecureApps8(new String[] {"Chromecast", "iOS", "Unknown app", "MediaPortal", "Media Portal", "iPad", "iPhone", "Roku", "Windows Phone"});
MetadataOptions tempVar = new MetadataOptions(1, 1280);
tempVar.setItemType("Book");
MetadataOptions tempVar2 = new MetadataOptions(1, 1280);
tempVar2.setItemType("Movie");
ImageOption tempVar3 = new ImageOption();
tempVar3.setLimit(3);
tempVar3.setMinWidth(1280);
tempVar3.setType(ImageType.Backdrop);
ImageOption tempVar4 = new ImageOption();
tempVar4.setLimit(0);
tempVar4.setType(ImageType.Art);
ImageOption tempVar5 = new ImageOption();
tempVar5.setLimit(0);
tempVar5.setType(ImageType.Disc);
ImageOption tempVar6 = new ImageOption();
tempVar6.setLimit(1);
tempVar6.setType(ImageType.Primary);
ImageOption tempVar7 = new ImageOption();
tempVar7.setLimit(1);
tempVar7.setType(ImageType.Banner);
ImageOption tempVar8 = new ImageOption();
tempVar8.setLimit(1);
tempVar8.setType(ImageType.Thumb);
ImageOption tempVar9 = new ImageOption();
tempVar9.setLimit(1);
tempVar9.setType(ImageType.Logo);
tempVar2.setImageOptions(new ImageOption[] {tempVar3, tempVar4, tempVar5, tempVar6, tempVar7, tempVar8, tempVar9});
MetadataOptions tempVar10 = new MetadataOptions(1, 1280);
tempVar10.setItemType("Series");
ImageOption tempVar11 = new ImageOption();
tempVar11.setLimit(2);
tempVar11.setMinWidth(1280);
tempVar11.setType(ImageType.Backdrop);
ImageOption tempVar12 = new ImageOption();
tempVar12.setLimit(0);
tempVar12.setType(ImageType.Art);
ImageOption tempVar13 = new ImageOption();
tempVar13.setLimit(1);
tempVar13.setType(ImageType.Primary);
ImageOption tempVar14 = new ImageOption();
tempVar14.setLimit(1);
tempVar14.setType(ImageType.Banner);
ImageOption tempVar15 = new ImageOption();
tempVar15.setLimit(1);
tempVar15.setType(ImageType.Thumb);
ImageOption tempVar16 = new ImageOption();
tempVar16.setLimit(1);
tempVar16.setType(ImageType.Logo);
tempVar10.setImageOptions(new ImageOption[] {tempVar11, tempVar12, tempVar13, tempVar14, tempVar15, tempVar16});
MetadataOptions tempVar17 = new MetadataOptions(1, 1280);
tempVar17.setItemType("MusicAlbum");
ImageOption tempVar18 = new ImageOption();
tempVar18.setLimit(1);
tempVar18.setMinWidth(1280);
tempVar18.setType(ImageType.Backdrop);
ImageOption tempVar19 = new ImageOption();
tempVar19.setLimit(0);
tempVar19.setType(ImageType.Disc);
tempVar17.setImageOptions(new ImageOption[] {tempVar18, tempVar19});
MetadataOptions tempVar20 = new MetadataOptions(1, 1280);
tempVar20.setItemType("MusicArtist");
ImageOption tempVar21 = new ImageOption();
tempVar21.setLimit(1);
tempVar21.setMinWidth(1280);
tempVar21.setType(ImageType.Backdrop);
ImageOption tempVar22 = new ImageOption();
tempVar22.setLimit(0);
tempVar22.setType(ImageType.Banner);
ImageOption tempVar23 = new ImageOption();
tempVar23.setLimit(0);
tempVar23.setType(ImageType.Art);
tempVar20.setImageOptions(new ImageOption[] {tempVar21, tempVar22, tempVar23});
MetadataOptions tempVar24 = new MetadataOptions(0, 1280);
tempVar24.setItemType("Season");
setMetadataOptions(new MetadataOptions[] {tempVar, tempVar2, tempVar10, tempVar17, tempVar20, tempVar24});
}
}

View File

@ -0,0 +1,13 @@
package mediabrowser.model.dlna;
import java.util.Comparator;
public abstract class BaseStreamInfoSorter implements Comparator<StreamInfo> {
protected abstract int getValue(StreamInfo info);
@Override
public int compare(StreamInfo lhs, StreamInfo rhs) {
return Integer.compare(getValue(lhs), getValue(rhs));
}
}

View File

@ -0,0 +1,28 @@
package mediabrowser.model.dlna;
import java.util.ArrayList;
import java.util.Comparator;
import java.util.List;
public class ChainedComparator<T> implements Comparator<T> {
private List<Comparator<T>> simpleComparators;
public ChainedComparator(Comparator<T>... simpleComparators) {
List<Comparator<T>> list = new ArrayList<>();
for (Comparator<T> comparator : simpleComparators){
list.add(comparator);
}
this.simpleComparators = list;
}
public int compare(T o1, T o2) {
for (Comparator<T> comparator : simpleComparators) {
int result = comparator.compare(o1, o2);
if (result != 0) {
return result;
}
}
return 0;
}
}

View File

@ -114,7 +114,7 @@ public class ConditionProcessor
case NotEquals:
return !currentValue.equals(expected);
default:
throw new UnsupportedOperationException("Unexpected ProfileConditionType");
throw new IllegalStateException("Unexpected ProfileConditionType");
}
}
@ -142,7 +142,7 @@ public class ConditionProcessor
case NotEquals:
return !StringHelper.EqualsIgnoreCase(currentValue, expected);
default:
throw new UnsupportedOperationException("Unexpected ProfileConditionType");
throw new IllegalStateException("Unexpected ProfileConditionType");
}
}
@ -167,7 +167,7 @@ public class ConditionProcessor
case NotEquals:
return currentValue != expected;
default:
throw new UnsupportedOperationException("Unexpected ProfileConditionType");
throw new IllegalStateException("Unexpected ProfileConditionType");
}
}
@ -199,7 +199,7 @@ public class ConditionProcessor
case NotEquals:
return !currentValue.equals(expected);
default:
throw new UnsupportedOperationException("Unexpected ProfileConditionType");
throw new IllegalStateException("Unexpected ProfileConditionType");
}
}
@ -231,7 +231,7 @@ public class ConditionProcessor
case NotEquals:
return !currentValue.equals(expected);
default:
throw new UnsupportedOperationException("Unexpected ProfileConditionType");
throw new IllegalStateException("Unexpected ProfileConditionType");
}
}
@ -257,7 +257,7 @@ public class ConditionProcessor
case NotEquals:
return timestamp != expected;
default:
throw new UnsupportedOperationException("Unexpected ProfileConditionType");
throw new IllegalStateException("Unexpected ProfileConditionType");
}
}
}

View File

@ -85,38 +85,14 @@ public class StreamBuilder
private StreamInfo GetOptimalStream(java.util.ArrayList<StreamInfo> streams)
{
// Grab the first one that can be direct streamed
// If that doesn't produce anything, just take the first
for (StreamInfo i : streams)
{
if (i.getPlayMethod() == PlayMethod.DirectPlay && i.getMediaSource().getProtocol() == MediaProtocol.File)
{
return i;
}
}
for (StreamInfo i : streams)
{
if (i.getPlayMethod() == PlayMethod.DirectPlay)
{
return i;
}
}
for (StreamInfo i : streams)
{
if (i.getPlayMethod() == PlayMethod.DirectStream)
{
return i;
}
}
streams = StreamInfoSorter.SortMediaSources(streams);
for (StreamInfo stream : streams)
{
return stream;
}
PlaybackException error = new PlaybackException();
error.setErrorCode(PlaybackErrorCode.NoCompatibleStream);
throw error;
return null;
}
private StreamInfo BuildAudioItem(MediaSourceInfo item, AudioOptions options)
@ -212,7 +188,7 @@ public class StreamBuilder
playlistItem.setEstimateContentLength(transcodingProfile.getEstimateContentLength());
playlistItem.setContainer(transcodingProfile.getContainer());
playlistItem.setAudioCodec(transcodingProfile.getAudioCodec());
playlistItem.setProtocol(transcodingProfile.getProtocol());
playlistItem.setSubProtocol(transcodingProfile.getProtocol());
java.util.ArrayList<CodecProfile> audioCodecProfiles = new java.util.ArrayList<CodecProfile>();
for (CodecProfile i : options.getProfile().getCodecProfiles())
@ -370,7 +346,7 @@ public class StreamBuilder
playlistItem.setTranscodeSeekInfo(transcodingProfile.getTranscodeSeekInfo());
playlistItem.setAudioCodec(transcodingProfile.getAudioCodec().split("[,]", -1)[0]);
playlistItem.setVideoCodec(transcodingProfile.getVideoCodec());
playlistItem.setProtocol(transcodingProfile.getProtocol());
playlistItem.setSubProtocol(transcodingProfile.getProtocol());
playlistItem.setAudioStreamIndex(audioStreamIndex);
java.util.ArrayList<ProfileCondition> videoTranscodingConditions = new java.util.ArrayList<ProfileCondition>();

View File

@ -61,14 +61,14 @@ public class StreamInfo
Container = value;
}
private String Protocol;
public final String getProtocol()
private String SubProtocol;
public final String getSubProtocol()
{
return Protocol;
return SubProtocol;
}
public final void setProtocol(String value)
public final void setSubProtocol(String value)
{
Protocol = value;
SubProtocol = value;
}
private long StartPositionTicks;
@ -314,12 +314,12 @@ public class StreamInfo
SubtitleFormat = value;
}
private LiveMediaInfoResult PlaybackInfo;
public final LiveMediaInfoResult getPlaybackInfo()
private PlaybackInfoResponse PlaybackInfo;
public final PlaybackInfoResponse getPlaybackInfo()
{
return PlaybackInfo;
}
public final void setPlaybackInfo(LiveMediaInfoResult value)
public final void setPlaybackInfo(PlaybackInfoResponse value)
{
PlaybackInfo = value;
}
@ -335,11 +335,6 @@ public class StreamInfo
}
public final String ToUrl(String baseUrl, String accessToken)
{
return ToDlnaUrl(baseUrl, accessToken);
}
public final String ToDlnaUrl(String baseUrl, String accessToken)
{
if (getPlayMethod() == PlayMethod.DirectPlay)
{
@ -351,7 +346,53 @@ public class StreamInfo
throw new IllegalArgumentException(baseUrl);
}
String dlnaCommand = BuildDlnaParam(this);
java.util.ArrayList<String> list = new java.util.ArrayList<String>();
for (NameValuePair pair : BuildParams(this, accessToken))
{
if (tangible.DotNetToJavaStringHelper.isNullOrEmpty(pair.getValue()))
{
continue;
}
// Try to keep the url clean by omitting defaults
if (StringHelper.EqualsIgnoreCase(pair.getName(), "StartTimeTicks") && StringHelper.EqualsIgnoreCase(pair.getValue(), "0"))
{
continue;
}
if (StringHelper.EqualsIgnoreCase(pair.getName(), "SubtitleStreamIndex") && StringHelper.EqualsIgnoreCase(pair.getValue(), "-1"))
{
continue;
}
if (StringHelper.EqualsIgnoreCase(pair.getName(), "Static") && StringHelper.EqualsIgnoreCase(pair.getValue(), "false"))
{
continue;
}
list.add(String.format("%1$s=%2$s", pair.getName(), pair.getValue()));
}
String queryString = tangible.DotNetToJavaStringHelper.join("&", list.toArray(new String[0]));
return GetUrl(baseUrl, queryString);
}
public final String ToDlnaUrl(String baseUrl, String accessToken)
{
if (getPlayMethod() == PlayMethod.DirectPlay)
{
return getMediaSource().getPath();
}
String dlnaCommand = BuildDlnaParam(this, accessToken);
return GetUrl(baseUrl, dlnaCommand);
}
private String GetUrl(String baseUrl, String queryString)
{
if (tangible.DotNetToJavaStringHelper.isNullOrEmpty(baseUrl))
{
throw new IllegalArgumentException(baseUrl);
}
String extension = tangible.DotNetToJavaStringHelper.isNullOrEmpty(getContainer()) ? "" : "." + getContainer();
@ -359,39 +400,69 @@ public class StreamInfo
if (getMediaType() == DlnaProfileType.Audio)
{
return String.format("%1$s/audio/%2$s/stream%3$s?%4$s", baseUrl, getItemId(), extension, dlnaCommand);
return String.format("%1$s/audio/%2$s/stream%3$s?%4$s", baseUrl, getItemId(), extension, queryString);
}
if (StringHelper.EqualsIgnoreCase(getProtocol(), "hls"))
if (StringHelper.EqualsIgnoreCase(getSubProtocol(), "hls"))
{
return String.format("%1$s/videos/%2$s/master.m3u8?%3$s", baseUrl, getItemId(), dlnaCommand);
return String.format("%1$s/videos/%2$s/master.m3u8?%3$s", baseUrl, getItemId(), queryString);
}
return String.format("%1$s/videos/%2$s/stream%3$s?%4$s", baseUrl, getItemId(), extension, dlnaCommand);
return String.format("%1$s/videos/%2$s/stream%3$s?%4$s", baseUrl, getItemId(), extension, queryString);
}
private static String BuildDlnaParam(StreamInfo item)
private static String BuildDlnaParam(StreamInfo item, String accessToken)
{
String tempVar = item.getDeviceProfileId();
String tempVar2 = item.getDeviceId();
String tempVar3 = item.getMediaSourceId();
String tempVar4 = item.getVideoCodec();
String tempVar5 = item.getAudioCodec();
java.util.ArrayList<String> list = new java.util.ArrayList<String>(java.util.Arrays.asList(new String[] {(tempVar != null) ? tempVar : "", (tempVar2 != null) ? tempVar2 : "", (tempVar3 != null) ? tempVar3 : "", (new Boolean(item.getIsDirectStream())).toString().toLowerCase(), (tempVar4 != null) ? tempVar4 : "", (tempVar5 != null) ? tempVar5 : "", item.getAudioStreamIndex() != null ? StringHelper.ToStringCultureInvariant(item.getAudioStreamIndex()) : "", item.getSubtitleStreamIndex() != null && item.getSubtitleDeliveryMethod() != mediabrowser.model.dlna.SubtitleDeliveryMethod.External ? StringHelper.ToStringCultureInvariant(item.getSubtitleStreamIndex()) : "", item.getVideoBitrate() != null ? StringHelper.ToStringCultureInvariant(item.getVideoBitrate()) : "", item.getAudioBitrate() != null ? StringHelper.ToStringCultureInvariant(item.getAudioBitrate()) : "", item.getMaxAudioChannels() != null ? StringHelper.ToStringCultureInvariant(item.getMaxAudioChannels()) : "", item.getMaxFramerate() != null ? StringHelper.ToStringCultureInvariant(item.getMaxFramerate()) : "", item.getMaxWidth() != null ? StringHelper.ToStringCultureInvariant(item.getMaxWidth()) : "", item.getMaxHeight() != null ? StringHelper.ToStringCultureInvariant(item.getMaxHeight()) : "", StringHelper.ToStringCultureInvariant(item.getStartPositionTicks()), item.getVideoLevel() != null ? StringHelper.ToStringCultureInvariant(item.getVideoLevel()) : ""}));
java.util.ArrayList<String> list = new java.util.ArrayList<String>();
list.add(item.getIsDirectStream() ? "" : String.valueOf(new java.util.Date().getTime()));
list.add(item.getMaxRefFrames() != null ? StringHelper.ToStringCultureInvariant(item.getMaxRefFrames()) : "");
list.add(item.getMaxVideoBitDepth() != null ? StringHelper.ToStringCultureInvariant(item.getMaxVideoBitDepth()) : "");
String tempVar6 = item.getVideoProfile();
list.add((tempVar6 != null) ? tempVar6 : "");
list.add(item.getCabac() != null ? item.getCabac().toString() : "");
String streamId = item.getPlaybackInfo() == null ? null : item.getPlaybackInfo().getStreamId();
list.add((streamId != null) ? streamId : "");
for (NameValuePair pair : BuildParams(item, accessToken))
{
list.add(pair.getValue());
}
return String.format("Params=%1$s", tangible.DotNetToJavaStringHelper.join(";", list.toArray(new String[0])));
}
private static java.util.ArrayList<NameValuePair> BuildParams(StreamInfo item, String accessToken)
{
java.util.ArrayList<NameValuePair> list = new java.util.ArrayList<NameValuePair>();
String tempVar = item.getDeviceProfileId();
list.add(new NameValuePair("DeviceProfileId", (tempVar != null) ? tempVar : ""));
String tempVar2 = item.getDeviceId();
list.add(new NameValuePair("DeviceId", (tempVar2 != null) ? tempVar2 : ""));
String tempVar3 = item.getMediaSourceId();
list.add(new NameValuePair("MediaSourceId", (tempVar3 != null) ? tempVar3 : ""));
list.add(new NameValuePair("Static", (new Boolean(item.getIsDirectStream())).toString().toLowerCase()));
String tempVar4 = item.getVideoCodec();
list.add(new NameValuePair("VideoCodec", (tempVar4 != null) ? tempVar4 : ""));
String tempVar5 = item.getAudioCodec();
list.add(new NameValuePair("AudioCodec", (tempVar5 != null) ? tempVar5 : ""));
list.add(new NameValuePair("AudioStreamIndex", item.getAudioStreamIndex() != null ? StringHelper.ToStringCultureInvariant(item.getAudioStreamIndex()) : ""));
list.add(new NameValuePair("SubtitleStreamIndex", item.getSubtitleStreamIndex() != null && item.getSubtitleDeliveryMethod() != mediabrowser.model.dlna.SubtitleDeliveryMethod.External ? StringHelper.ToStringCultureInvariant(item.getSubtitleStreamIndex()) : ""));
list.add(new NameValuePair("VideoBitrate", item.getVideoBitrate() != null ? StringHelper.ToStringCultureInvariant(item.getVideoBitrate()) : ""));
list.add(new NameValuePair("AudioBitrate", item.getAudioBitrate() != null ? StringHelper.ToStringCultureInvariant(item.getAudioBitrate()) : ""));
list.add(new NameValuePair("MaxAudioChannels", item.getMaxAudioChannels() != null ? StringHelper.ToStringCultureInvariant(item.getMaxAudioChannels()) : ""));
list.add(new NameValuePair("MaxFramerate", item.getMaxFramerate() != null ? StringHelper.ToStringCultureInvariant(item.getMaxFramerate()) : ""));
list.add(new NameValuePair("MaxWidth", item.getMaxWidth() != null ? StringHelper.ToStringCultureInvariant(item.getMaxWidth()) : ""));
list.add(new NameValuePair("MaxHeight", item.getMaxHeight() != null ? StringHelper.ToStringCultureInvariant(item.getMaxHeight()) : ""));
list.add(new NameValuePair("StartTimeTicks", StringHelper.ToStringCultureInvariant(item.getStartPositionTicks())));
list.add(new NameValuePair("Level", item.getVideoLevel() != null ? StringHelper.ToStringCultureInvariant(item.getVideoLevel()) : ""));
list.add(new NameValuePair("ClientTime", item.getIsDirectStream() ? "" : String.valueOf(new java.util.Date().getTime())));
list.add(new NameValuePair("MaxRefFrames", item.getMaxRefFrames() != null ? StringHelper.ToStringCultureInvariant(item.getMaxRefFrames()) : ""));
list.add(new NameValuePair("MaxVideoBitDepth", item.getMaxVideoBitDepth() != null ? StringHelper.ToStringCultureInvariant(item.getMaxVideoBitDepth()) : ""));
String tempVar6 = item.getVideoProfile();
list.add(new NameValuePair("Profile", (tempVar6 != null) ? tempVar6 : ""));
list.add(new NameValuePair("Cabac", item.getCabac() != null ? item.getCabac().toString() : ""));
String streamId = item.getPlaybackInfo() == null ? null : item.getPlaybackInfo().getStreamId();
list.add(new NameValuePair("StreamId", (streamId != null) ? streamId : ""));
list.add(new NameValuePair("api_key", (accessToken != null) ? accessToken : ""));
return list;
}
public final java.util.ArrayList<SubtitleStreamInfo> GetExternalSubtitles(boolean includeSelectedTrackOnly)
{
java.util.ArrayList<SubtitleStreamInfo> list = new java.util.ArrayList<SubtitleStreamInfo>();
@ -442,7 +513,7 @@ public class StreamInfo
java.util.ArrayList<SubtitleStreamInfo> list = new java.util.ArrayList<SubtitleStreamInfo>();
// HLS will preserve timestamps so we can just grab the full subtitle stream
long startPositionTicks = StringHelper.EqualsIgnoreCase(getProtocol(), "hls") ? 0 : getStartPositionTicks();
long startPositionTicks = StringHelper.EqualsIgnoreCase(getSubProtocol(), "hls") ? 0 : getStartPositionTicks();
// First add the selected track
if (getSubtitleStreamIndex() != null)
@ -501,14 +572,14 @@ public class StreamInfo
return null;
}
String tempVar = stream.getLanguage();
SubtitleStreamInfo tempVar2 = new SubtitleStreamInfo();
tempVar2.setIsForced(stream.getIsForced());
tempVar2.setLanguage(stream.getLanguage());
tempVar2.setName((tempVar != null) ? tempVar : "Unknown");
tempVar2.setFormat(getSubtitleFormat());
tempVar2.setIndex(stream.getIndex());
return tempVar2;
SubtitleStreamInfo tempVar = new SubtitleStreamInfo();
tempVar.setIsForced(stream.getIsForced());
tempVar.setLanguage(stream.getLanguage());
String tempVar2 = stream.getLanguage();
tempVar.setName((tempVar2 != null) ? tempVar2 : "Unknown");
tempVar.setFormat(getSubtitleFormat());
tempVar.setIndex(stream.getIndex());
return tempVar;
}
/**
@ -720,7 +791,7 @@ public class StreamInfo
ImageSize tempVar = new ImageSize();
tempVar.setWidth(videoStream.getWidth());
tempVar.setHeight(videoStream.getHeight());
ImageSize size = tempVar;
ImageSize size = tempVar.clone();
Double maxWidth = getMaxWidth() != null ? (double)getMaxWidth() : (Double)null;
Double maxHeight = getMaxHeight() != null ? (double)getMaxHeight() : (Double)null;
@ -742,7 +813,7 @@ public class StreamInfo
ImageSize tempVar = new ImageSize();
tempVar.setWidth(videoStream.getWidth());
tempVar.setHeight(videoStream.getHeight());
ImageSize size = tempVar;
ImageSize size = tempVar.clone();
Double maxWidth = getMaxWidth() != null ? (double)getMaxWidth() : (Double)null;
Double maxHeight = getMaxHeight() != null ? (double)getMaxHeight() : (Double)null;

View File

@ -0,0 +1,18 @@
package mediabrowser.model.dlna;
import java.util.Collections;
public class StreamInfoSorter
{
public static java.util.ArrayList<StreamInfo> SortMediaSources(java.util.ArrayList<StreamInfo> streams)
{
ChainedComparator<StreamInfo> comparator = new ChainedComparator<>(
new StreamInfoSorterComparator(0),
new StreamInfoSorterComparator(1),
new StreamInfoSorterComparator(2)
);
Collections.sort(streams, comparator);
return streams;
}
}

View File

@ -0,0 +1,50 @@
package mediabrowser.model.dlna;
import mediabrowser.model.mediainfo.MediaProtocol;
import mediabrowser.model.session.PlayMethod;
public class StreamInfoSorterComparator extends BaseStreamInfoSorter {
private int level;
public StreamInfoSorterComparator(int level) {
this.level = level;
}
@Override
protected int getValue(StreamInfo info) {
switch (level){
case 0:
{
if (info.getPlayMethod() == PlayMethod.DirectPlay && info.getMediaSource().getProtocol() == MediaProtocol.File)
{
return 0;
}
return 1;
}
case 1:
{
if (info.getPlayMethod() == PlayMethod.DirectPlay && info.getMediaSource().getProtocol() == MediaProtocol.File)
{
return 0;
}
return 1;
}
case 2:
{
if (info.getPlayMethod() == PlayMethod.DirectPlay && info.getMediaSource().getProtocol() == MediaProtocol.File)
{
return 0;
}
return 1;
}
}
throw new IllegalArgumentException("Unrecognized level");
}
}

View File

@ -18,7 +18,7 @@ public final class DrawingUtils
ImageSize tempVar = new ImageSize();
tempVar.setWidth(currentWidth);
tempVar.setHeight(currentHeight);
return Scale(tempVar, scaleFactor);
return Scale(tempVar.clone(), scaleFactor);
}
/**
@ -51,7 +51,7 @@ public final class DrawingUtils
ImageSize tempVar = new ImageSize();
tempVar.setWidth(currentWidth);
tempVar.setHeight(currentHeight);
return Resize(tempVar, width, height, maxWidth, maxHeight);
return Resize(tempVar.clone(), width, height, maxWidth, maxHeight);
}
/**

View File

@ -110,6 +110,15 @@ public class MediaSourceInfo
{
SupportsDirectStream = value;
}
private boolean SupportsDirectPlay;
public final boolean getSupportsDirectPlay()
{
return SupportsDirectPlay;
}
public final void setSupportsDirectPlay(boolean value)
{
SupportsDirectPlay = value;
}
private VideoType VideoType = null;
public final VideoType getVideoType()
@ -199,6 +208,34 @@ public class MediaSourceInfo
RequiredHttpHeaders = value;
}
private String TranscodingUrl;
public final String getTranscodingUrl()
{
return TranscodingUrl;
}
public final void setTranscodingUrl(String value)
{
TranscodingUrl = value;
}
private String TranscodingSubProtocol;
public final String getTranscodingSubProtocol()
{
return TranscodingSubProtocol;
}
public final void setTranscodingSubProtocol(String value)
{
TranscodingSubProtocol = value;
}
private String TranscodingContainer;
public final String getTranscodingContainer()
{
return TranscodingContainer;
}
public final void setTranscodingContainer(String value)
{
TranscodingContainer = value;
}
public MediaSourceInfo()
{
setFormats(new java.util.ArrayList<String>());
@ -207,6 +244,7 @@ public class MediaSourceInfo
setPlayableStreamFileNames(new java.util.ArrayList<String>());
setSupportsTranscoding(true);
setSupportsDirectStream(true);
setSupportsDirectPlay(true);
}
private Integer DefaultAudioStreamIndex = null;

View File

@ -2,6 +2,17 @@ package mediabrowser.model.dto;
public class NameValuePair
{
public NameValuePair()
{
}
public NameValuePair(String name, String value)
{
setName(name);
setValue(value);
}
/**
Gets or sets the name.

View File

@ -227,9 +227,9 @@ public class RecordingInfoDto implements IHasPropertyChangedEvent, IItemDto, IHa
}
/**
Gets or sets a value indicating whether this instance can deleteUserAction.
Gets or sets a value indicating whether this instance can delete.
<value><c>null</c> if [can deleteUserAction] contains no value, <c>true</c> if [can deleteUserAction]; otherwise, <c>false</c>.</value>
<value><c>null</c> if [can delete] contains no value, <c>true</c> if [can delete]; otherwise, <c>false</c>.</value>
*/
private Boolean CanDelete = null;
public final Boolean getCanDelete()

View File

@ -0,0 +1,26 @@
package mediabrowser.model.mediainfo;
import mediabrowser.model.dlna.*;
import mediabrowser.model.dto.*;
public class PlaybackInfoRequest
{
private DeviceProfile DeviceProfile;
public final DeviceProfile getDeviceProfile()
{
return DeviceProfile;
}
public final void setDeviceProfile(DeviceProfile value)
{
DeviceProfile = value;
}
private MediaSourceInfo MediaSource;
public final MediaSourceInfo getMediaSource()
{
return MediaSource;
}
public final void setMediaSource(MediaSourceInfo value)
{
MediaSource = value;
}
}

View File

@ -3,7 +3,7 @@ package mediabrowser.model.mediainfo;
import mediabrowser.model.dlna.*;
import mediabrowser.model.dto.*;
public class LiveMediaInfoResult
public class PlaybackInfoResponse
{
/**
Gets or sets the media sources.
@ -50,7 +50,7 @@ public class LiveMediaInfoResult
ErrorCode = value;
}
public LiveMediaInfoResult()
public PlaybackInfoResponse()
{
setMediaSources(new java.util.ArrayList<MediaSourceInfo>());
}

View File

@ -26,7 +26,7 @@ public enum ItemFields
Budget,
/**
The can deleteUserAction
The can delete
*/
CanDelete,
@ -95,6 +95,11 @@ public enum ItemFields
*/
IndexOptions,
/**
The item counts
*/
ItemCounts,
/**
The keywords
*/

View File

@ -11,14 +11,14 @@ public class LocalItemQuery
{
ServerId = value;
}
private String AlbumArtist;
public final String getAlbumArtist()
private String AlbumArtistId;
public final String getAlbumArtistId()
{
return AlbumArtist;
return AlbumArtistId;
}
public final void setAlbumArtist(String value)
public final void setAlbumArtistId(String value)
{
AlbumArtist = value;
AlbumArtistId = value;
}
private String AlbumId;
public final String getAlbumId()

View File

@ -32,6 +32,34 @@ public class SyncedItem
{
SyncJobId = value;
}
/**
Gets or sets the name of the synchronize job.
<value>The name of the synchronize job.</value>
*/
private String SyncJobName;
public final String getSyncJobName()
{
return SyncJobName;
}
public final void setSyncJobName(String value)
{
SyncJobName = value;
}
/**
Gets or sets the synchronize job date created.
<value>The synchronize job date created.</value>
*/
private java.util.Date SyncJobDateCreated = new java.util.Date(0);
public final java.util.Date getSyncJobDateCreated()
{
return SyncJobDateCreated;
}
public final void setSyncJobDateCreated(java.util.Date value)
{
SyncJobDateCreated = value;
}
/**
Gets or sets the synchronize job item identifier.

View File

@ -79,4 +79,19 @@ public class TaskTriggerInfo
{
DayOfWeek = value;
}
/**
Gets or sets the maximum runtime ms.
<value>The maximum runtime ms.</value>
*/
private Integer MaxRuntimeMs = null;
public final Integer getMaxRuntimeMs()
{
return MaxRuntimeMs;
}
public final void setMaxRuntimeMs(Integer value)
{
MaxRuntimeMs = value;
}
}

View File

@ -31,7 +31,7 @@ public class CheckForUpdateResult
}
public final void setAvailableVersion(String value)
{
}
} // need this for the serializer
/**
Get or sets package information for an available update