mirror of
https://github.com/jellyfin/jellyfin-sdk-kotlin.git
synced 2024-12-04 03:51:09 +00:00
finished MediaSync
This commit is contained in:
parent
16e062200b
commit
b2ed839c61
273
.idea/workspace.xml
generated
273
.idea/workspace.xml
generated
@ -7,9 +7,12 @@
|
||||
</component>
|
||||
<component name="ChangeListManager">
|
||||
<list default="true" id="5b626835-6518-4586-bf6c-5bbba32974d2" name="Default" comment="">
|
||||
<change type="NEW" beforePath="" afterPath="$PROJECT_DIR$/src/mediabrowser/apiinteraction/playback/GetPlaybackInfoResponse.java" />
|
||||
<change type="NEW" beforePath="" afterPath="$PROJECT_DIR$/src/mediabrowser/apiinteraction/playback/StopTranscodingResponse.java" />
|
||||
<change type="MODIFICATION" beforePath="$PROJECT_DIR$/src/mediabrowser/apiinteraction/playback/PlaybackManager.java" afterPath="$PROJECT_DIR$/src/mediabrowser/apiinteraction/playback/PlaybackManager.java" />
|
||||
<change type="NEW" beforePath="" afterPath="$PROJECT_DIR$/src/mediabrowser/model/results/ReadySyncItemsResult.java" />
|
||||
<change type="MODIFICATION" beforePath="$PROJECT_DIR$/src/mediabrowser/apiinteraction/ApiClient.java" afterPath="$PROJECT_DIR$/src/mediabrowser/apiinteraction/ApiClient.java" />
|
||||
<change type="MODIFICATION" beforePath="$PROJECT_DIR$/src/mediabrowser/apiinteraction/sync/data/ILocalAssetManager.java" afterPath="$PROJECT_DIR$/src/mediabrowser/apiinteraction/sync/data/ILocalAssetManager.java" />
|
||||
<change type="MODIFICATION" beforePath="$PROJECT_DIR$/src/mediabrowser/apiinteraction/sync/data/LocalAssetManager.java" afterPath="$PROJECT_DIR$/src/mediabrowser/apiinteraction/sync/data/LocalAssetManager.java" />
|
||||
<change type="MODIFICATION" beforePath="$PROJECT_DIR$/src/mediabrowser/apiinteraction/sync/server/mediasync/MediaSync.java" afterPath="$PROJECT_DIR$/src/mediabrowser/apiinteraction/sync/server/mediasync/MediaSync.java" />
|
||||
<change type="MODIFICATION" beforePath="$PROJECT_DIR$/src/mediabrowser/apiinteraction/sync/data/NullAssetManager.java" afterPath="$PROJECT_DIR$/src/mediabrowser/apiinteraction/sync/data/NullAssetManager.java" />
|
||||
<change type="MODIFICATION" beforePath="$PROJECT_DIR$/.idea/workspace.xml" afterPath="$PROJECT_DIR$/.idea/workspace.xml" />
|
||||
</list>
|
||||
<ignored path="MediaBrowser.ApiClient.Java.iws" />
|
||||
@ -37,11 +40,53 @@
|
||||
</component>
|
||||
<component name="FileEditorManager">
|
||||
<leaf>
|
||||
<file leaf-file-name="MediaSync.java" pinned="false" current-in-tab="true">
|
||||
<file leaf-file-name="NullAssetManager.java" pinned="false" current-in-tab="false">
|
||||
<entry file="file://$PROJECT_DIR$/src/mediabrowser/apiinteraction/sync/data/NullAssetManager.java">
|
||||
<provider selected="true" editor-type-id="text-editor">
|
||||
<state vertical-scroll-proportion="0.0" vertical-offset="527" max-vertical-offset="2074">
|
||||
<caret line="91" column="25" selection-start-line="90" selection-start-column="4" selection-end-line="91" selection-end-column="25" />
|
||||
<folding />
|
||||
</state>
|
||||
</provider>
|
||||
</entry>
|
||||
</file>
|
||||
<file leaf-file-name="MediaSync.java" pinned="false" current-in-tab="false">
|
||||
<entry file="file://$PROJECT_DIR$/src/mediabrowser/apiinteraction/sync/server/mediasync/MediaSync.java">
|
||||
<provider selected="true" editor-type-id="text-editor">
|
||||
<state vertical-scroll-proportion="0.4510993" vertical-offset="1938" max-vertical-offset="3553">
|
||||
<caret line="177" column="6" selection-start-line="177" selection-start-column="6" selection-end-line="177" selection-end-column="6" />
|
||||
<state vertical-scroll-proportion="0.0" vertical-offset="3065" max-vertical-offset="6851">
|
||||
<caret line="251" column="25" selection-start-line="251" selection-start-column="25" selection-end-line="251" selection-end-column="25" />
|
||||
<folding>
|
||||
<element signature="e#3739#3740#0" expanded="true" />
|
||||
<element signature="e#3827#3828#0" expanded="true" />
|
||||
<element signature="e#3931#3932#0" expanded="true" />
|
||||
<element signature="e#4025#4026#0" expanded="true" />
|
||||
<element signature="method#GetNextImage#0;class#MediaSync#0" expanded="false" />
|
||||
</folding>
|
||||
</state>
|
||||
</provider>
|
||||
</entry>
|
||||
</file>
|
||||
<file leaf-file-name="LocalAssetManager.java" pinned="false" current-in-tab="true">
|
||||
<entry file="file://$PROJECT_DIR$/src/mediabrowser/apiinteraction/sync/data/LocalAssetManager.java">
|
||||
<provider selected="true" editor-type-id="text-editor">
|
||||
<state vertical-scroll-proportion="0.5403101" vertical-offset="1649" max-vertical-offset="11747">
|
||||
<caret line="148" column="28" selection-start-line="148" selection-start-column="28" selection-end-line="148" selection-end-column="28" />
|
||||
<folding>
|
||||
<element signature="imports" expanded="true" />
|
||||
<element signature="e#2743#2757#0" expanded="true" />
|
||||
<element signature="e#6307#6315#0" expanded="true" />
|
||||
<element signature="e#7545#7553#0" expanded="true" />
|
||||
<element signature="e#10061#10074#0" expanded="true" />
|
||||
</folding>
|
||||
</state>
|
||||
</provider>
|
||||
</entry>
|
||||
</file>
|
||||
<file leaf-file-name="ILocalAssetManager.java" pinned="false" current-in-tab="false">
|
||||
<entry file="file://$PROJECT_DIR$/src/mediabrowser/apiinteraction/sync/data/ILocalAssetManager.java">
|
||||
<provider selected="true" editor-type-id="text-editor">
|
||||
<state vertical-scroll-proportion="0.0" vertical-offset="107" max-vertical-offset="1173">
|
||||
<caret line="46" column="9" selection-start-line="46" selection-start-column="9" selection-end-line="46" selection-end-column="9" />
|
||||
<folding />
|
||||
</state>
|
||||
</provider>
|
||||
@ -55,7 +100,6 @@
|
||||
<component name="IdeDocumentHistory">
|
||||
<option name="CHANGED_PATHS">
|
||||
<list>
|
||||
<option value="$PROJECT_DIR$/src/mediabrowser/apiinteraction/sync/ServerSync.java" />
|
||||
<option value="$PROJECT_DIR$/src/mediabrowser/apiinteraction/sync/server/ServerSyncConnectionResponse.java" />
|
||||
<option value="$PROJECT_DIR$/src/mediabrowser/apiinteraction/sync/server/FileUploadProgress.java" />
|
||||
<option value="$PROJECT_DIR$/src/mediabrowser/apiinteraction/sync/server/ServerSync.java" />
|
||||
@ -81,20 +125,16 @@
|
||||
<option value="$PROJECT_DIR$/src/mediabrowser/apiinteraction/sync/server/mediasync/SyncDataInnerResponse.java" />
|
||||
<option value="$PROJECT_DIR$/src/mediabrowser/apiinteraction/sync/server/mediasync/SecondSyncDataResponse.java" />
|
||||
<option value="$PROJECT_DIR$/src/mediabrowser/apiinteraction/sync/server/mediasync/InitialSyncDataResponse.java" />
|
||||
<option value="$PROJECT_DIR$/src/mediabrowser/apiinteraction/sync/server/mediasync/MediaSync.java" />
|
||||
<option value="$PROJECT_DIR$/src/mediabrowser/model/results/SyncJobQueryResult.java" />
|
||||
<option value="$PROJECT_DIR$/src/mediabrowser/model/sync/SyncJobQuery.java" />
|
||||
<option value="$PROJECT_DIR$/src/mediabrowser/model/results/SyncJobItemQueryResult.java" />
|
||||
<option value="$PROJECT_DIR$/src/mediabrowser/model/sync/SyncJobItemQuery.java" />
|
||||
<option value="$PROJECT_DIR$/src/mediabrowser/apiinteraction/sync/data/ILocalAssetManager.java" />
|
||||
<option value="$PROJECT_DIR$/src/mediabrowser/apiinteraction/sync/data/NullAssetManager.java" />
|
||||
<option value="$PROJECT_DIR$/src/mediabrowser/apiinteraction/android/sync/MediaSyncAdapter.java" />
|
||||
<option value="$PROJECT_DIR$/src/mediabrowser/model/querying/ItemQuery.java" />
|
||||
<option value="$PROJECT_DIR$/src/mediabrowser/apiinteraction/BaseApiClient.java" />
|
||||
<option value="$PROJECT_DIR$/src/mediabrowser/model/dlna/profiles/DefaultProfile.java" />
|
||||
<option value="$PROJECT_DIR$/src/mediabrowser/model/dlna/StreamBuilder.java" />
|
||||
<option value="$PROJECT_DIR$/src/mediabrowser/model/dlna/StreamInfo.java" />
|
||||
<option value="$PROJECT_DIR$/src/mediabrowser/apiinteraction/ApiClient.java" />
|
||||
<option value="$PROJECT_DIR$/src/mediabrowser/apiinteraction/playback/ReportPlaybackStopResponse.java" />
|
||||
<option value="$PROJECT_DIR$/src/mediabrowser/apiinteraction/IConnectionManager.java" />
|
||||
<option value="$PROJECT_DIR$/src/mediabrowser/apiinteraction/connectionmanager/DeviceResumeFromSleepObservable.java" />
|
||||
@ -102,10 +142,15 @@
|
||||
<option value="$PROJECT_DIR$/src/mediabrowser/apiinteraction/sync/data/comparators/NameComparator.java" />
|
||||
<option value="$PROJECT_DIR$/src/mediabrowser/apiinteraction/sync/data/comparators/SortNameComparator.java" />
|
||||
<option value="$PROJECT_DIR$/src/mediabrowser/apiinteraction/sync/data/IItemRepository.java" />
|
||||
<option value="$PROJECT_DIR$/src/mediabrowser/apiinteraction/sync/data/LocalAssetManager.java" />
|
||||
<option value="$PROJECT_DIR$/src/mediabrowser/apiinteraction/playback/GetPlaybackInfoResponse.java" />
|
||||
<option value="$PROJECT_DIR$/src/mediabrowser/apiinteraction/playback/StopTranscodingResponse.java" />
|
||||
<option value="$PROJECT_DIR$/src/mediabrowser/apiinteraction/playback/PlaybackManager.java" />
|
||||
<option value="$PROJECT_DIR$/src/mediabrowser/model/results/ReadySyncItemsResult.java" />
|
||||
<option value="$PROJECT_DIR$/src/mediabrowser/apiinteraction/ApiClient.java" />
|
||||
<option value="$PROJECT_DIR$/src/mediabrowser/apiinteraction/sync/server/mediasync/MediaSync.java" />
|
||||
<option value="$PROJECT_DIR$/src/mediabrowser/apiinteraction/sync/data/ILocalAssetManager.java" />
|
||||
<option value="$PROJECT_DIR$/src/mediabrowser/apiinteraction/sync/data/NullAssetManager.java" />
|
||||
<option value="$PROJECT_DIR$/src/mediabrowser/apiinteraction/sync/data/LocalAssetManager.java" />
|
||||
</list>
|
||||
</option>
|
||||
</component>
|
||||
@ -220,6 +265,32 @@
|
||||
<option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.PsiDirectoryNode" />
|
||||
</PATH_ELEMENT>
|
||||
</PATH>
|
||||
<PATH>
|
||||
<PATH_ELEMENT>
|
||||
<option name="myItemId" value="MediaBrowser.ApiClient.Java" />
|
||||
<option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.ProjectViewProjectNode" />
|
||||
</PATH_ELEMENT>
|
||||
<PATH_ELEMENT>
|
||||
<option name="myItemId" value="MediaBrowser.ApiClient.Java" />
|
||||
<option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.PsiDirectoryNode" />
|
||||
</PATH_ELEMENT>
|
||||
<PATH_ELEMENT>
|
||||
<option name="myItemId" value="src" />
|
||||
<option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.PsiDirectoryNode" />
|
||||
</PATH_ELEMENT>
|
||||
<PATH_ELEMENT>
|
||||
<option name="myItemId" value="mediabrowser" />
|
||||
<option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.PsiDirectoryNode" />
|
||||
</PATH_ELEMENT>
|
||||
<PATH_ELEMENT>
|
||||
<option name="myItemId" value="model" />
|
||||
<option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.PsiDirectoryNode" />
|
||||
</PATH_ELEMENT>
|
||||
<PATH_ELEMENT>
|
||||
<option name="myItemId" value="results" />
|
||||
<option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.PsiDirectoryNode" />
|
||||
</PATH_ELEMENT>
|
||||
</PATH>
|
||||
<PATH>
|
||||
<PATH_ELEMENT>
|
||||
<option name="myItemId" value="MediaBrowser.ApiClient.Java" />
|
||||
@ -741,7 +812,7 @@
|
||||
</component>
|
||||
<component name="XDebuggerManager">
|
||||
<breakpoint-manager>
|
||||
<option name="time" value="8" />
|
||||
<option name="time" value="9" />
|
||||
</breakpoint-manager>
|
||||
<watches-manager />
|
||||
</component>
|
||||
@ -750,27 +821,6 @@
|
||||
<option name="FILTER_TARGETS" value="false" />
|
||||
</component>
|
||||
<component name="editorHistoryManager">
|
||||
<entry file="file://$PROJECT_DIR$/src/mediabrowser/apiinteraction/connectionmanager/FindServersInnerResponse.java">
|
||||
<provider selected="true" editor-type-id="text-editor">
|
||||
<state vertical-scroll-proportion="0.04952077" vertical-offset="40" max-vertical-offset="1292">
|
||||
<caret line="11" column="48" selection-start-line="11" selection-start-column="48" selection-end-line="11" selection-end-column="48" />
|
||||
</state>
|
||||
</provider>
|
||||
</entry>
|
||||
<entry file="file://$PROJECT_DIR$/src/mediabrowser/apiinteraction/connectionmanager/GetRegistrationInfoInnerResponse.java">
|
||||
<provider selected="true" editor-type-id="text-editor">
|
||||
<state vertical-scroll-proportion="0.5838658" vertical-offset="0" max-vertical-offset="1252">
|
||||
<caret line="43" column="0" selection-start-line="43" selection-start-column="0" selection-end-line="43" selection-end-column="0" />
|
||||
</state>
|
||||
</provider>
|
||||
</entry>
|
||||
<entry file="file://$PROJECT_DIR$/src/mediabrowser/apiinteraction/connect/ConnectService.java">
|
||||
<provider selected="true" editor-type-id="text-editor">
|
||||
<state vertical-scroll-proportion="0.0" vertical-offset="2386" max-vertical-offset="3655">
|
||||
<caret line="202" column="35" selection-start-line="202" selection-start-column="16" selection-end-line="202" selection-end-column="35" />
|
||||
</state>
|
||||
</provider>
|
||||
</entry>
|
||||
<entry file="file://$PROJECT_DIR$/src/mediabrowser/apiinteraction/connectionmanager/GetRegistrationInfoFindServersResponse.java">
|
||||
<provider selected="true" editor-type-id="text-editor">
|
||||
<state vertical-scroll-proportion="0.0" vertical-offset="274" max-vertical-offset="1513">
|
||||
@ -855,13 +905,6 @@
|
||||
</state>
|
||||
</provider>
|
||||
</entry>
|
||||
<entry file="file://$PROJECT_DIR$/src/mediabrowser/apiinteraction/sync/data/IFileRepository.java">
|
||||
<provider selected="true" editor-type-id="text-editor">
|
||||
<state vertical-scroll-proportion="0.0" vertical-offset="0" max-vertical-offset="476">
|
||||
<caret line="7" column="32" selection-start-line="7" selection-start-column="17" selection-end-line="7" selection-end-column="32" />
|
||||
</state>
|
||||
</provider>
|
||||
</entry>
|
||||
<entry file="file://$PROJECT_DIR$/src/mediabrowser/apiinteraction/sync/data/IImageRepository.java">
|
||||
<provider selected="true" editor-type-id="text-editor">
|
||||
<state vertical-scroll-proportion="0.0" vertical-offset="0" max-vertical-offset="340">
|
||||
@ -869,13 +912,6 @@
|
||||
</state>
|
||||
</provider>
|
||||
</entry>
|
||||
<entry file="file://$PROJECT_DIR$/src/mediabrowser/apiinteraction/sync/data/ILocalAssetManager.java">
|
||||
<provider selected="true" editor-type-id="text-editor">
|
||||
<state vertical-scroll-proportion="0.0" vertical-offset="0" max-vertical-offset="1139">
|
||||
<caret line="44" column="12" selection-start-line="44" selection-start-column="12" selection-end-line="44" selection-end-column="12" />
|
||||
</state>
|
||||
</provider>
|
||||
</entry>
|
||||
<entry file="file://$PROJECT_DIR$/src/mediabrowser/apiinteraction/sync/data/IUserRepository.java">
|
||||
<provider selected="true" editor-type-id="text-editor">
|
||||
<state vertical-scroll-proportion="0.0" vertical-offset="0" max-vertical-offset="340">
|
||||
@ -892,14 +928,6 @@
|
||||
</state>
|
||||
</provider>
|
||||
</entry>
|
||||
<entry file="file://$PROJECT_DIR$/src/mediabrowser/apiinteraction/sync/data/NullAssetManager.java">
|
||||
<provider selected="true" editor-type-id="text-editor">
|
||||
<state vertical-scroll-proportion="0.0" vertical-offset="612" max-vertical-offset="2346">
|
||||
<caret line="44" column="0" selection-start-line="44" selection-start-column="0" selection-end-line="44" selection-end-column="0" />
|
||||
<folding />
|
||||
</state>
|
||||
</provider>
|
||||
</entry>
|
||||
<entry file="file://$PROJECT_DIR$/src/mediabrowser/apiinteraction/android/sync/MediaSyncAdapter.java">
|
||||
<provider selected="true" editor-type-id="text-editor">
|
||||
<state vertical-scroll-proportion="0.0" vertical-offset="0" max-vertical-offset="1309">
|
||||
@ -1066,14 +1094,6 @@
|
||||
</state>
|
||||
</provider>
|
||||
</entry>
|
||||
<entry file="file://$PROJECT_DIR$/src/mediabrowser/apiinteraction/ApiClient.java">
|
||||
<provider selected="true" editor-type-id="text-editor">
|
||||
<state vertical-scroll-proportion="0.38232374" vertical-offset="37406" max-vertical-offset="43962">
|
||||
<caret line="2290" column="9" selection-start-line="2287" selection-start-column="8" selection-end-line="2290" selection-end-column="9" />
|
||||
<folding />
|
||||
</state>
|
||||
</provider>
|
||||
</entry>
|
||||
<entry file="jar://$MAVEN_REPOSITORY$/com/google/guava/guava/18.0/guava-18.0.jar!/com/google/common/io/Files.class">
|
||||
<provider selected="true" editor-type-id="text-editor">
|
||||
<state vertical-scroll-proportion="0.6354379" vertical-offset="4578" max-vertical-offset="6919">
|
||||
@ -1112,44 +1132,6 @@
|
||||
</state>
|
||||
</provider>
|
||||
</entry>
|
||||
<entry file="file://$PROJECT_DIR$/src/mediabrowser/apiinteraction/sync/data/LocalAssetManager.java">
|
||||
<provider selected="true" editor-type-id="text-editor">
|
||||
<state vertical-scroll-proportion="0.60079443" vertical-offset="7249" max-vertical-offset="10659">
|
||||
<caret line="462" column="23" selection-start-line="462" selection-start-column="23" selection-end-line="462" selection-end-column="23" />
|
||||
<folding>
|
||||
<element signature="imports" expanded="true" />
|
||||
<element signature="e#1747#1748#0" expanded="true" />
|
||||
<element signature="e#1798#1799#0" expanded="true" />
|
||||
<element signature="e#1854#1855#0" expanded="true" />
|
||||
<element signature="e#1905#1906#0" expanded="true" />
|
||||
<element signature="e#1987#1988#0" expanded="true" />
|
||||
<element signature="e#2044#2045#0" expanded="true" />
|
||||
<element signature="e#2105#2106#0" expanded="true" />
|
||||
<element signature="e#2153#2154#0" expanded="true" />
|
||||
<element signature="e#2479#2493#0" expanded="true" />
|
||||
<element signature="e#3874#3875#0" expanded="true" />
|
||||
<element signature="e#3921#3922#0" expanded="true" />
|
||||
<element signature="e#5247#5248#0" expanded="true" />
|
||||
<element signature="e#5297#5298#0" expanded="true" />
|
||||
<element signature="e#5380#5381#0" expanded="true" />
|
||||
<element signature="e#5445#5446#0" expanded="true" />
|
||||
<element signature="e#5505#5506#0" expanded="true" />
|
||||
<element signature="e#5559#5560#0" expanded="true" />
|
||||
<element signature="e#5639#5640#0" expanded="true" />
|
||||
<element signature="e#5703#5704#0" expanded="true" />
|
||||
<element signature="e#5766#5767#0" expanded="true" />
|
||||
<element signature="e#5828#5829#0" expanded="true" />
|
||||
<element signature="e#5890#5891#0" expanded="true" />
|
||||
<element signature="e#5931#5932#0" expanded="true" />
|
||||
<element signature="e#7213#7226#0" expanded="true" />
|
||||
<element signature="e#19295#19296#0" expanded="true" />
|
||||
<element signature="e#19340#19341#0" expanded="true" />
|
||||
<element signature="e#19419#19420#0" expanded="true" />
|
||||
<element signature="e#19470#19471#0" expanded="true" />
|
||||
</folding>
|
||||
</state>
|
||||
</provider>
|
||||
</entry>
|
||||
<entry file="file://$PROJECT_DIR$/src/mediabrowser/apiinteraction/sync/data/IItemRepository.java">
|
||||
<provider selected="true" editor-type-id="text-editor">
|
||||
<state vertical-scroll-proportion="0.30387288" vertical-offset="0" max-vertical-offset="1007">
|
||||
@ -1182,11 +1164,92 @@
|
||||
</state>
|
||||
</provider>
|
||||
</entry>
|
||||
<entry file="file://$PROJECT_DIR$/src/mediabrowser/apiinteraction/tasks/Progress.java">
|
||||
<provider selected="true" editor-type-id="text-editor">
|
||||
<state vertical-scroll-proportion="0.025777103" vertical-offset="0" max-vertical-offset="1319">
|
||||
<caret line="2" column="13" selection-start-line="2" selection-start-column="13" selection-end-line="2" selection-end-column="13" />
|
||||
<folding />
|
||||
</state>
|
||||
</provider>
|
||||
</entry>
|
||||
<entry file="file://$PROJECT_DIR$/src/mediabrowser/model/results/ReadySyncItemsResult.java">
|
||||
<provider selected="true" editor-type-id="text-editor">
|
||||
<state vertical-scroll-proportion="0.14825581" vertical-offset="0" max-vertical-offset="1032">
|
||||
<caret line="9" column="33" selection-start-line="9" selection-start-column="13" selection-end-line="9" selection-end-column="33" />
|
||||
<folding>
|
||||
<element signature="imports" expanded="true" />
|
||||
</folding>
|
||||
</state>
|
||||
</provider>
|
||||
</entry>
|
||||
<entry file="file://$PROJECT_DIR$/src/mediabrowser/model/sync/LocalItem.java">
|
||||
<provider selected="true" editor-type-id="text-editor">
|
||||
<state vertical-scroll-proportion="0.39534885" vertical-offset="0" max-vertical-offset="1105">
|
||||
<caret line="30" column="29" selection-start-line="30" selection-start-column="29" selection-end-line="30" selection-end-column="29" />
|
||||
<folding>
|
||||
<element signature="e#451#452#0" expanded="true" />
|
||||
<element signature="e#474#475#0" expanded="true" />
|
||||
</folding>
|
||||
</state>
|
||||
</provider>
|
||||
</entry>
|
||||
<entry file="file://$PROJECT_DIR$/src/mediabrowser/apiinteraction/sync/data/IFileRepository.java">
|
||||
<provider selected="true" editor-type-id="text-editor">
|
||||
<state vertical-scroll-proportion="0.13178295" vertical-offset="0" max-vertical-offset="1032">
|
||||
<caret line="11" column="9" selection-start-line="11" selection-start-column="9" selection-end-line="11" selection-end-column="9" />
|
||||
<folding />
|
||||
</state>
|
||||
</provider>
|
||||
</entry>
|
||||
<entry file="file://$PROJECT_DIR$/src/mediabrowser/apiinteraction/sync/data/ILocalAssetManager.java">
|
||||
<provider selected="true" editor-type-id="text-editor">
|
||||
<state vertical-scroll-proportion="0.0" vertical-offset="107" max-vertical-offset="1173">
|
||||
<caret line="46" column="9" selection-start-line="46" selection-start-column="9" selection-end-line="46" selection-end-column="9" />
|
||||
<folding />
|
||||
</state>
|
||||
</provider>
|
||||
</entry>
|
||||
<entry file="file://$PROJECT_DIR$/src/mediabrowser/apiinteraction/sync/data/NullAssetManager.java">
|
||||
<provider selected="true" editor-type-id="text-editor">
|
||||
<state vertical-scroll-proportion="0.0" vertical-offset="527" max-vertical-offset="2074">
|
||||
<caret line="91" column="25" selection-start-line="90" selection-start-column="4" selection-end-line="91" selection-end-column="25" />
|
||||
<folding />
|
||||
</state>
|
||||
</provider>
|
||||
</entry>
|
||||
<entry file="file://$PROJECT_DIR$/src/mediabrowser/apiinteraction/ApiClient.java">
|
||||
<provider selected="true" editor-type-id="text-editor">
|
||||
<state vertical-scroll-proportion="0.34995013" vertical-offset="41758" max-vertical-offset="44149">
|
||||
<caret line="2544" column="8" selection-start-line="2543" selection-start-column="8" selection-end-line="2544" selection-end-column="8" />
|
||||
<folding />
|
||||
</state>
|
||||
</provider>
|
||||
</entry>
|
||||
<entry file="file://$PROJECT_DIR$/src/mediabrowser/apiinteraction/sync/server/mediasync/MediaSync.java">
|
||||
<provider selected="true" editor-type-id="text-editor">
|
||||
<state vertical-scroll-proportion="0.4510993" vertical-offset="1938" max-vertical-offset="3553">
|
||||
<caret line="177" column="6" selection-start-line="177" selection-start-column="6" selection-end-line="177" selection-end-column="6" />
|
||||
<folding />
|
||||
<state vertical-scroll-proportion="0.0" vertical-offset="3065" max-vertical-offset="6851">
|
||||
<caret line="251" column="25" selection-start-line="251" selection-start-column="25" selection-end-line="251" selection-end-column="25" />
|
||||
<folding>
|
||||
<element signature="e#3739#3740#0" expanded="true" />
|
||||
<element signature="e#3827#3828#0" expanded="true" />
|
||||
<element signature="e#3931#3932#0" expanded="true" />
|
||||
<element signature="e#4025#4026#0" expanded="true" />
|
||||
<element signature="method#GetNextImage#0;class#MediaSync#0" expanded="false" />
|
||||
</folding>
|
||||
</state>
|
||||
</provider>
|
||||
</entry>
|
||||
<entry file="file://$PROJECT_DIR$/src/mediabrowser/apiinteraction/sync/data/LocalAssetManager.java">
|
||||
<provider selected="true" editor-type-id="text-editor">
|
||||
<state vertical-scroll-proportion="0.5403101" vertical-offset="1649" max-vertical-offset="11747">
|
||||
<caret line="148" column="28" selection-start-line="148" selection-start-column="28" selection-end-line="148" selection-end-column="28" />
|
||||
<folding>
|
||||
<element signature="imports" expanded="true" />
|
||||
<element signature="e#2743#2757#0" expanded="true" />
|
||||
<element signature="e#6307#6315#0" expanded="true" />
|
||||
<element signature="e#7545#7553#0" expanded="true" />
|
||||
<element signature="e#10061#10074#0" expanded="true" />
|
||||
</folding>
|
||||
</state>
|
||||
</provider>
|
||||
</entry>
|
||||
|
Binary file not shown.
@ -2645,4 +2645,15 @@ public class ApiClient extends BaseApiClient {
|
||||
getResponseStream(url, response);
|
||||
}
|
||||
|
||||
public void getReadySyncItems(String targetId, Response<ReadySyncItemsResult> response) {
|
||||
|
||||
QueryStringDictionary dict = new QueryStringDictionary();
|
||||
|
||||
dict.AddIfNotNullOrEmpty("TargetId", targetId);
|
||||
|
||||
String url = GetApiUrl("Sync/Items/Ready", dict);
|
||||
url = AddDataFormat(url);
|
||||
|
||||
Send(url, "GET", new SerializedResponse<ReadySyncItemsResult>(response, jsonSerializer, ReadySyncItemsResult.class));
|
||||
}
|
||||
}
|
@ -44,6 +44,8 @@ public interface ILocalAssetManager {
|
||||
|
||||
boolean fileExists(String path);
|
||||
|
||||
void saveMedia(InputStream stream, LocalItem localItem, ServerInfo server);
|
||||
|
||||
ArrayList<String> getServerItemIds(String serverId);
|
||||
|
||||
void saveOfflineUser(UserDto user);
|
||||
|
@ -1,15 +1,20 @@
|
||||
package mediabrowser.apiinteraction.sync.data;
|
||||
|
||||
import com.android.internal.telephony.cat.Input;
|
||||
import com.google.common.io.Files;
|
||||
import mediabrowser.apiinteraction.cryptography.Md5;
|
||||
import mediabrowser.apiinteraction.sync.data.comparators.SortNameComparator;
|
||||
import mediabrowser.model.apiclient.ServerInfo;
|
||||
import mediabrowser.model.dto.BaseItemDto;
|
||||
import mediabrowser.model.dto.MediaSourceInfo;
|
||||
import mediabrowser.model.dto.UserDto;
|
||||
import mediabrowser.model.entities.CollectionType;
|
||||
import mediabrowser.model.entities.ImageType;
|
||||
import mediabrowser.model.entities.MediaType;
|
||||
import mediabrowser.model.extensions.ListHelper;
|
||||
import mediabrowser.model.extensions.StringHelper;
|
||||
import mediabrowser.model.logging.ILogger;
|
||||
import mediabrowser.model.mediainfo.MediaProtocol;
|
||||
import mediabrowser.model.sync.*;
|
||||
import mediabrowser.model.users.UserAction;
|
||||
|
||||
@ -28,6 +33,7 @@ public class LocalAssetManager implements ILocalAssetManager {
|
||||
private IFileRepository fileRepository;
|
||||
private IUserRepository userRepository;
|
||||
private IImageRepository imageRepository;
|
||||
private ILogger logger;
|
||||
|
||||
public LocalAssetManager(IUserActionRepository userActionRepository, IItemRepository itemRepository, IFileRepository fileRepository, IUserRepository userRepository, IImageRepository imageRepository) {
|
||||
this.userActionRepository = userActionRepository;
|
||||
@ -101,6 +107,13 @@ public class LocalAssetManager implements ILocalAssetManager {
|
||||
return itemFiles;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void saveMedia(InputStream stream, LocalItem localItem, ServerInfo server)
|
||||
{
|
||||
logger.Debug("Saving media to " + localItem.getLocalPath());
|
||||
fileRepository.saveFile(stream, localItem.getLocalPath());
|
||||
}
|
||||
|
||||
private static String[] SupportedImageExtensions = { ".png", ".jpg", ".jpeg", ".webp" };
|
||||
private boolean isImageFile(String path)
|
||||
{
|
||||
@ -159,14 +172,92 @@ public class LocalAssetManager implements ILocalAssetManager {
|
||||
|
||||
@Override
|
||||
public LocalItem createLocalItem(BaseItemDto libraryItem, ServerInfo server, String originalFileName) {
|
||||
|
||||
ArrayList<String> path = getDirectoryPath(libraryItem, server);
|
||||
path.add(getLocalFileName(libraryItem, originalFileName));
|
||||
|
||||
LocalItem item = new LocalItem();
|
||||
|
||||
String localPath = fileRepository.getFullLocalPath(path);
|
||||
|
||||
for (MediaSourceInfo mediaSource : libraryItem.getMediaSources())
|
||||
{
|
||||
mediaSource.setPath(localPath);
|
||||
mediaSource.setProtocol(MediaProtocol.File);
|
||||
}
|
||||
|
||||
item.setServerId(server.getId());
|
||||
item.setItem(libraryItem);
|
||||
item.setItemId(libraryItem.getId());
|
||||
item.setId(getLocalId(item.getServerId(), item.getItemId()));
|
||||
return item;
|
||||
}
|
||||
|
||||
private ArrayList<String> getDirectoryPath(BaseItemDto item, ServerInfo server)
|
||||
{
|
||||
ArrayList<String> parts = new ArrayList<String>();
|
||||
parts.add(server.getName());
|
||||
|
||||
if (item.IsType("episode"))
|
||||
{
|
||||
parts.add("TV");
|
||||
parts.add(item.getSeriesName());
|
||||
|
||||
if (!tangible.DotNetToJavaStringHelper.isNullOrEmpty(item.getSeasonName()))
|
||||
{
|
||||
parts.add(item.getSeasonName());
|
||||
}
|
||||
}
|
||||
else if (item.getIsVideo())
|
||||
{
|
||||
parts.add("Videos");
|
||||
parts.add(item.getName());
|
||||
}
|
||||
else if (item.getIsAudio())
|
||||
{
|
||||
parts.add("Music");
|
||||
|
||||
if (!tangible.DotNetToJavaStringHelper.isNullOrEmpty(item.getAlbumArtist()))
|
||||
{
|
||||
parts.add(item.getAlbumArtist());
|
||||
}
|
||||
|
||||
if (!tangible.DotNetToJavaStringHelper.isNullOrEmpty(item.getAlbumId()))
|
||||
{
|
||||
parts.add(item.getAlbum());
|
||||
}
|
||||
}
|
||||
else if (StringHelper.EqualsIgnoreCase(item.getMediaType(), MediaType.Photo))
|
||||
{
|
||||
parts.add("Photos");
|
||||
|
||||
if (!tangible.DotNetToJavaStringHelper.isNullOrEmpty(item.getAlbumId()))
|
||||
{
|
||||
parts.add(item.getAlbum());
|
||||
}
|
||||
}
|
||||
|
||||
ArrayList<String> finalParts = new ArrayList<String>();
|
||||
|
||||
for (String part : parts){
|
||||
finalParts.add(fileRepository.getValidFileName(part));
|
||||
}
|
||||
|
||||
return finalParts;
|
||||
}
|
||||
|
||||
private String getLocalFileName(BaseItemDto item, String originalFileName)
|
||||
{
|
||||
String filename = originalFileName;
|
||||
|
||||
if (tangible.DotNetToJavaStringHelper.isNullOrEmpty(filename))
|
||||
{
|
||||
filename = item.getName();
|
||||
}
|
||||
|
||||
return fileRepository.getValidFileName(filename);
|
||||
}
|
||||
|
||||
@Override
|
||||
public LocalItem getLocalItem(String localId) {
|
||||
return itemRepository.get(localId);
|
||||
|
@ -88,6 +88,12 @@ public class NullAssetManager implements ILocalAssetManager {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void saveMedia(InputStream stream, LocalItem localItem, ServerInfo server)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void deleteOfflineUser(String id) {
|
||||
|
||||
|
@ -1,27 +1,31 @@
|
||||
package mediabrowser.apiinteraction.sync.server.mediasync;
|
||||
|
||||
import android.app.IActivityPendingResult;
|
||||
import mediabrowser.apiinteraction.ApiClient;
|
||||
import mediabrowser.apiinteraction.EmptyResponse;
|
||||
import mediabrowser.apiinteraction.Response;
|
||||
import mediabrowser.apiinteraction.sync.data.ILocalAssetManager;
|
||||
import mediabrowser.apiinteraction.tasks.CancellationToken;
|
||||
import mediabrowser.apiinteraction.tasks.IProgress;
|
||||
import mediabrowser.apiinteraction.tasks.Progress;
|
||||
import mediabrowser.model.apiclient.ServerInfo;
|
||||
import mediabrowser.model.apiclient.ServerUserInfo;
|
||||
import mediabrowser.model.devices.LocalFileInfo;
|
||||
import mediabrowser.model.dto.BaseItemDto;
|
||||
import mediabrowser.model.dto.ImageOptions;
|
||||
import mediabrowser.model.dto.MediaSourceInfo;
|
||||
import mediabrowser.model.entities.ImageType;
|
||||
import mediabrowser.model.entities.MediaStream;
|
||||
import mediabrowser.model.entities.MediaStreamType;
|
||||
import mediabrowser.model.logging.ILogger;
|
||||
import mediabrowser.model.sync.ItemFileInfo;
|
||||
import mediabrowser.model.sync.LocalItem;
|
||||
import mediabrowser.model.sync.SyncDataRequest;
|
||||
import mediabrowser.model.sync.SyncedItem;
|
||||
import mediabrowser.model.results.ReadySyncItemsResult;
|
||||
import mediabrowser.model.sync.*;
|
||||
import mediabrowser.model.users.UserAction;
|
||||
import org.apache.maven.settings.Server;
|
||||
import org.apache.tools.ant.taskdefs.Local;
|
||||
|
||||
import java.io.InputStream;
|
||||
import java.lang.reflect.Array;
|
||||
import java.util.ArrayList;
|
||||
|
||||
/**
|
||||
@ -77,10 +81,17 @@ public class MediaSync {
|
||||
progress.report(3.0);
|
||||
|
||||
// Get new media
|
||||
GetNewMedia(apiClient, serverInfo, cancellationToken, new EmptyResponse() {
|
||||
GetNewMedia(apiClient, serverInfo, cancellationToken, new Progress<Double>() {
|
||||
|
||||
@Override
|
||||
public void onResponse() {
|
||||
public void onCancelled() {
|
||||
|
||||
progress.reportCancelled();
|
||||
return;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onComplete() {
|
||||
|
||||
progress.report(99.0);
|
||||
|
||||
@ -92,6 +103,11 @@ public class MediaSync {
|
||||
public void onError(Exception ex) {
|
||||
progress.reportError(ex);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onProgress(Double val) {
|
||||
progress.report(3 + .96 * val);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@ -131,13 +147,226 @@ public class MediaSync {
|
||||
apiClient.SyncData(request, new SyncDataInnerResponse(response, localAssetManager, serverInfo, syncUserItemAccess));
|
||||
}
|
||||
|
||||
private void GetNewMedia(ApiClient apiClient,
|
||||
ServerInfo serverInfo,
|
||||
CancellationToken cancellationToken,
|
||||
final EmptyResponse response){
|
||||
private void GetNewMedia(final ApiClient apiClient,
|
||||
final ServerInfo serverInfo,
|
||||
final CancellationToken cancellationToken,
|
||||
final IProgress<Double> progress){
|
||||
|
||||
apiClient.getReadySyncItems(apiClient.getDeviceId(), new Response<ReadySyncItemsResult>() {
|
||||
|
||||
response.onResponse();
|
||||
@Override
|
||||
public void onResponse(ReadySyncItemsResult result) {
|
||||
|
||||
ArrayList<SyncedItem> jobItems = result;
|
||||
|
||||
GetNextItem(jobItems, 0, apiClient, serverInfo, cancellationToken, progress);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onError(Exception ex) {
|
||||
|
||||
progress.reportError(ex);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
private void GetNextItem(final ArrayList<SyncedItem> jobItems, final int index, final ApiClient apiClient, final ServerInfo serverInfo, final CancellationToken cancellationToken, final IProgress<Double> progress){
|
||||
|
||||
if (index >= jobItems.size()){
|
||||
progress.reportComplete();
|
||||
return;
|
||||
}
|
||||
|
||||
if (cancellationToken.isCancellationRequested()){
|
||||
progress.reportCancelled();
|
||||
return;
|
||||
}
|
||||
|
||||
SyncedItem jobItem = jobItems.get(index);
|
||||
|
||||
GetItem(apiClient, serverInfo, jobItem, cancellationToken, new EmptyResponse() {
|
||||
|
||||
private void onAny() {
|
||||
|
||||
int numComplete = index + 1;
|
||||
double startingPercent = numComplete;
|
||||
startingPercent /= jobItems.size();
|
||||
startingPercent *= 100;
|
||||
progress.report(startingPercent);
|
||||
|
||||
GetNextItem(jobItems, index + 1, apiClient, serverInfo, cancellationToken, progress);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onResponse() {
|
||||
|
||||
onAny();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onError(Exception ex) {
|
||||
logger.ErrorException("Error getting synced item", ex);
|
||||
onAny();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
private void GetItem(final ApiClient apiClient,
|
||||
ServerInfo server,
|
||||
final SyncedItem jobItem,
|
||||
final CancellationToken cancellationToken,
|
||||
final EmptyResponse response){
|
||||
|
||||
BaseItemDto libraryItem = jobItem.getItem();
|
||||
|
||||
final LocalItem localItem = localAssetManager.createLocalItem(libraryItem, server, jobItem.getOriginalFileName());
|
||||
|
||||
apiClient.GetSyncJobItemFile(jobItem.getSyncJobItemId(), new Response<InputStream>(){
|
||||
|
||||
@Override
|
||||
public void onResponse(InputStream stream) {
|
||||
|
||||
// Create db record
|
||||
localAssetManager.addOrUpdate(localItem);
|
||||
|
||||
GetNextImage(0, apiClient, localItem, cancellationToken, new Progress<Double>() {
|
||||
|
||||
@Override
|
||||
public void onComplete() {
|
||||
|
||||
GetSubtitles(apiClient, jobItem, localItem, cancellationToken, new Progress<Double>() {
|
||||
|
||||
@Override
|
||||
public void onComplete() {
|
||||
|
||||
response.onResponse();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onCancelled() {
|
||||
|
||||
response.onResponse();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onError(Exception ex) {
|
||||
|
||||
response.onError(ex);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onCancelled() {
|
||||
|
||||
response.onResponse();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onError(Exception ex) {
|
||||
|
||||
response.onError(ex);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onError(Exception ex) {
|
||||
|
||||
response.onError(ex);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
private void GetNextImage(final int index, final ApiClient apiClient, final LocalItem item, final CancellationToken cancellationToken, final IProgress<Double> progress) {
|
||||
|
||||
final int numImages = 4;
|
||||
|
||||
if (index >= numImages){
|
||||
progress.reportComplete();
|
||||
return;
|
||||
}
|
||||
|
||||
if (cancellationToken.isCancellationRequested()){
|
||||
progress.reportCancelled();
|
||||
return;
|
||||
}
|
||||
|
||||
BaseItemDto libraryItem = item.getItem();
|
||||
|
||||
String serverId = libraryItem.getServerId();
|
||||
String itemId = null;
|
||||
String imageTag = null;
|
||||
ImageType imageType = ImageType.Primary;
|
||||
|
||||
switch (index) {
|
||||
|
||||
case 0:
|
||||
itemId = libraryItem.getId();
|
||||
imageType = ImageType.Primary;
|
||||
imageTag = libraryItem.getImageTags() == null ?
|
||||
null :
|
||||
libraryItem.getImageTags().get(ImageType.Primary);
|
||||
break;
|
||||
case 1:
|
||||
itemId = libraryItem.getSeriesId();
|
||||
imageType = ImageType.Primary;
|
||||
imageTag = libraryItem.getSeriesPrimaryImageTag();
|
||||
break;
|
||||
case 2:
|
||||
itemId = libraryItem.getSeriesId();
|
||||
imageType = ImageType.Thumb;
|
||||
imageTag = libraryItem.getSeriesPrimaryImageTag();
|
||||
break;
|
||||
case 3:
|
||||
itemId = libraryItem.getAlbumId();
|
||||
imageType = ImageType.Primary;
|
||||
imageTag = libraryItem.getAlbumPrimaryImageTag();
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
if (tangible.DotNetToJavaStringHelper.isNullOrEmpty(itemId))
|
||||
{
|
||||
progress.reportComplete();
|
||||
return;
|
||||
}
|
||||
|
||||
if (tangible.DotNetToJavaStringHelper.isNullOrEmpty(imageTag))
|
||||
{
|
||||
int numComplete = index + 1;
|
||||
double startingPercent = numComplete;
|
||||
startingPercent /= numImages;
|
||||
startingPercent *= 100;
|
||||
progress.report(startingPercent);
|
||||
|
||||
GetNextImage(index + 1, apiClient, item, cancellationToken, progress);
|
||||
return;
|
||||
}
|
||||
|
||||
DownloadImage(apiClient, serverId, itemId, imageTag, imageType, new EmptyResponse() {
|
||||
|
||||
@Override
|
||||
public void onResponse() {
|
||||
|
||||
int numComplete = index + 1;
|
||||
double startingPercent = numComplete;
|
||||
startingPercent /= numImages;
|
||||
startingPercent *= 100;
|
||||
progress.report(startingPercent);
|
||||
|
||||
GetNextImage(index + 1, apiClient, item, cancellationToken, progress);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onError(Exception ex) {
|
||||
|
||||
logger.ErrorException("Error downloading image", ex);
|
||||
GetNextImage(index + 1, apiClient, item, cancellationToken, progress);
|
||||
}
|
||||
|
||||
});
|
||||
}
|
||||
|
||||
private void DownloadImage(ApiClient apiClient,
|
||||
@ -172,40 +401,96 @@ public class MediaSync {
|
||||
});
|
||||
}
|
||||
|
||||
private void DownloadSubtitle(ApiClient apiClient,
|
||||
SyncedItem jobItem,
|
||||
final LocalItem item,
|
||||
MediaSourceInfo mediaSource,
|
||||
ItemFileInfo file,
|
||||
final EmptyResponse response)
|
||||
{
|
||||
private void GetSubtitles(ApiClient apiClient,
|
||||
SyncedItem jobItem,
|
||||
final LocalItem item,
|
||||
CancellationToken cancellationToken,
|
||||
IProgress<Double> progress) {
|
||||
|
||||
ArrayList<ItemFileInfo> files = new ArrayList<>();
|
||||
|
||||
for (ItemFileInfo file : jobItem.getAdditionalFiles()){
|
||||
|
||||
if (file.getType() == ItemFileType.Subtitles){
|
||||
files.add(file);
|
||||
}
|
||||
}
|
||||
|
||||
if (jobItem.getItem().getMediaSources().size() == 0){
|
||||
logger.Error("Cannot download subtitles because video has no media source info.");
|
||||
return;
|
||||
}
|
||||
|
||||
MediaSourceInfo mediaSource = jobItem.getItem().getMediaSources().get(0);
|
||||
|
||||
GetNextSubtitle(files, 0, apiClient, jobItem, item, mediaSource, cancellationToken, progress);
|
||||
}
|
||||
|
||||
private void GetNextSubtitle(final ArrayList<ItemFileInfo> files,
|
||||
final int index,
|
||||
final ApiClient apiClient,
|
||||
final SyncedItem jobItem,
|
||||
final LocalItem item,
|
||||
final MediaSourceInfo mediaSource,
|
||||
final CancellationToken cancellationToken,
|
||||
final IProgress<Double> progress) {
|
||||
|
||||
if (index >= files.size()){
|
||||
progress.reportComplete();
|
||||
return;
|
||||
}
|
||||
|
||||
if (cancellationToken.isCancellationRequested()){
|
||||
progress.reportCancelled();
|
||||
return;
|
||||
}
|
||||
|
||||
ItemFileInfo file = files.get(index);
|
||||
MediaStream subtitleStream = null;
|
||||
|
||||
for(MediaStream stream : mediaSource.getMediaStreams()){
|
||||
if (stream.getType() == MediaStreamType.Subtitle && stream.getIndex()== file.getIndex()){
|
||||
for (MediaStream stream : mediaSource.getMediaStreams()){
|
||||
|
||||
if (stream.getType() == MediaStreamType.Subtitle && stream.getIndex() == file.getIndex()){
|
||||
subtitleStream = stream;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (subtitleStream == null){
|
||||
response.onError(new Exception("MediaStream not found."));
|
||||
|
||||
// We shouldn't get in here, but let's just be safe anyway
|
||||
logger.Error("Cannot download subtitles because matching stream info wasn't found.");
|
||||
GetNextSubtitle(files, index + 1, apiClient, jobItem, item, mediaSource, cancellationToken, progress);
|
||||
return;
|
||||
}
|
||||
|
||||
final MediaStream finalSubtitleStream = subtitleStream;
|
||||
apiClient.getSyncJobItemAdditionalFile(jobItem.getSyncJobItemId(), file.getName(), new Response<InputStream> (){
|
||||
|
||||
private void onAny(){
|
||||
|
||||
int numComplete = index + 1;
|
||||
double startingPercent = numComplete;
|
||||
startingPercent /= files.size();
|
||||
startingPercent *= 100;
|
||||
progress.report(startingPercent);
|
||||
|
||||
GetNextSubtitle(files, index + 1, apiClient, jobItem, item, mediaSource, cancellationToken, progress);
|
||||
}
|
||||
|
||||
apiClient.getSyncJobItemAdditionalFile(jobItem.getSyncJobItemId(), file.getName(), new Response<InputStream>(response){
|
||||
@Override
|
||||
public void onResponse(InputStream stream) {
|
||||
|
||||
String path = localAssetManager.saveSubtitles(stream, finalSubtitleStream.getCodec(), item, finalSubtitleStream.getLanguage(), finalSubtitleStream.getIsForced());
|
||||
|
||||
finalSubtitleStream.setPath(path);
|
||||
|
||||
localAssetManager.addOrUpdate(item);
|
||||
onAny();
|
||||
}
|
||||
|
||||
triggerInnerResponse();
|
||||
@Override
|
||||
public void onError(Exception ex){
|
||||
logger.ErrorException("Error downloading subtitles", ex);
|
||||
onAny();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
11
src/mediabrowser/model/results/ReadySyncItemsResult.java
Normal file
11
src/mediabrowser/model/results/ReadySyncItemsResult.java
Normal file
@ -0,0 +1,11 @@
|
||||
package mediabrowser.model.results;
|
||||
|
||||
import mediabrowser.model.sync.SyncedItem;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
||||
/**
|
||||
* Created by Luke on 3/24/2015.
|
||||
*/
|
||||
public class ReadySyncItemsResult extends ArrayList<SyncedItem> {
|
||||
}
|
Loading…
Reference in New Issue
Block a user