mirror of
https://gitlab.futo.org/videostreaming/grayjay.git
synced 2025-05-07 18:14:39 +02:00
Open playlist urls support, indexOutOfBound fix for queue when deleting items
This commit is contained in:
parent
9306024d17
commit
196cacb452
@ -649,6 +649,14 @@ class MainActivity : AppCompatActivity, IWithResultLauncher {
|
|||||||
};
|
};
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
else if(StatePlatform.instance.hasEnabledPlaylistClient(url)) {
|
||||||
|
navigate(_fragMainPlaylist, url);
|
||||||
|
lifecycleScope.launch {
|
||||||
|
delay(100);
|
||||||
|
_fragVideoDetail.minimizeVideoDetail();
|
||||||
|
};
|
||||||
|
return true;
|
||||||
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
fun handleContent(file: String, mime: String? = null): Boolean {
|
fun handleContent(file: String, mime: String? = null): Boolean {
|
||||||
|
@ -841,6 +841,7 @@ class StatePlatform {
|
|||||||
return urls;
|
return urls;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fun hasEnabledPlaylistClient(url: String) : Boolean = getEnabledClients().any { it.isPlaylistUrl(url) };
|
||||||
fun getPlaylistClientOrNull(url: String): IPlatformClient? = getEnabledClients().find { it.isPlaylistUrl(url) }
|
fun getPlaylistClientOrNull(url: String): IPlatformClient? = getEnabledClients().find { it.isPlaylistUrl(url) }
|
||||||
fun getPlaylistClient(url: String): IPlatformClient = getEnabledClients().find { it.isPlaylistUrl(url) }
|
fun getPlaylistClient(url: String): IPlatformClient = getEnabledClients().find { it.isPlaylistUrl(url) }
|
||||||
?: throw NoPlatformClientException("No client enabled that supports this playlist url (${url})");
|
?: throw NoPlatformClientException("No client enabled that supports this playlist url (${url})");
|
||||||
|
@ -361,6 +361,12 @@ class StatePlayer {
|
|||||||
if (queueShuffle) {
|
if (queueShuffle) {
|
||||||
removeFromShuffledQueue(video);
|
removeFromShuffledQueue(video);
|
||||||
}
|
}
|
||||||
|
if(currentVideo != null) {
|
||||||
|
val newPos = _queue.indexOfFirst { it.url == currentVideo?.url };
|
||||||
|
if(newPos >= 0)
|
||||||
|
_queuePosition = newPos;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
onQueueChanged.emit(shouldSwapCurrentItem);
|
onQueueChanged.emit(shouldSwapCurrentItem);
|
||||||
@ -407,6 +413,12 @@ class StatePlayer {
|
|||||||
if(_queue.size == 1) {
|
if(_queue.size == 1) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
if(_queue.size <= _queuePosition && currentVideo != null) {
|
||||||
|
//Out of sync position
|
||||||
|
val newPos = _queue.indexOfFirst { it.url == currentVideo?.url }
|
||||||
|
if(newPos != -1)
|
||||||
|
_queuePosition = newPos;
|
||||||
|
}
|
||||||
|
|
||||||
val shuffledQueue = _queueShuffled;
|
val shuffledQueue = _queueShuffled;
|
||||||
val queue = if (queueShuffle && shuffledQueue != null) {
|
val queue = if (queueShuffle && shuffledQueue != null) {
|
||||||
@ -421,6 +433,8 @@ class StatePlayer {
|
|||||||
}
|
}
|
||||||
//Standard Behavior
|
//Standard Behavior
|
||||||
if(_queuePosition - 1 >= 0) {
|
if(_queuePosition - 1 >= 0) {
|
||||||
|
if(queue.size <= _queuePosition)
|
||||||
|
return null;
|
||||||
return queue[_queuePosition - 1];
|
return queue[_queuePosition - 1];
|
||||||
}
|
}
|
||||||
//Repeat Behavior (End of queue)
|
//Repeat Behavior (End of queue)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user