Skip to content

Commit

Permalink
Merge branch 'dev' into release/0.6.x
Browse files Browse the repository at this point in the history
* 0.6.2
  • Loading branch information
mikooomich committed Sep 13, 2024
2 parents 24b505e + 4b05b11 commit eae00fa
Show file tree
Hide file tree
Showing 15 changed files with 166 additions and 236 deletions.
2 changes: 1 addition & 1 deletion .github/ISSUE_TEMPLATE/bug_report.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ body:
label: Checklist
description: You should ensure the completion of the task before proceeding to check it off the checklist. Neglecting to do so may impede the efficiency of the issue resolution process. The developer has the right to delete the issue directly if you check the list blindly.
options:
- label: I am able to reproduce the bug with the [latest debug version](https://github.com/z-huang/OuterTune/actions).
- label: I am able to reproduce the bug with the [latest debug version](https://github.com/dd3boh/OuterTune/actions).
required: true
- label: I've checked that there is no open or closed issue about this bug.
required: true
Expand Down
8 changes: 4 additions & 4 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,10 @@ jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4

- name: set up JDK 17
uses: actions/setup-java@v3
uses: actions/setup-java@v4
with:
java-version: 17
distribution: "temurin"
Expand All @@ -29,7 +29,7 @@ jobs:
run: ./gradlew assembleUniversalDebug lintUniversalDebug testUniversalDebugUnitTest --stacktrace -DskipFormatKtlint

- name: Upload APK
uses: actions/upload-artifact@v3
uses: actions/upload-artifact@v4
with:
name: app
path: app/build/outputs/apk/debug/*.apk
path: app/build/outputs/apk/universal/debug/*.apk
8 changes: 4 additions & 4 deletions .github/workflows/build_pr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,10 @@ jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4

- name: set up JDK 17
uses: actions/setup-java@v3
uses: actions/setup-java@v4
with:
java-version: 17
distribution: "temurin"
Expand All @@ -23,7 +23,7 @@ jobs:
PULL_REQUEST: 'true'

- name: Upload APK
uses: actions/upload-artifact@v3
uses: actions/upload-artifact@v4
with:
name: app
path: app/build/outputs/apk/debug/*.apk
path: app/build/outputs/apk/universal/debug/*.apk
6 changes: 3 additions & 3 deletions app/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,9 @@ android {
defaultConfig {
applicationId = "com.dd3boh.outertune"
minSdk = 24
targetSdk = 34
versionCode = 22
versionName = "0.6.1"
targetSdk = 35
versionCode = 23
versionName = "0.6.2"
testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner"
}
buildTypes {
Expand Down
Binary file modified app/prebuilt/ffMetadataEx-release.aar
Binary file not shown.
28 changes: 21 additions & 7 deletions app/src/main/java/com/dd3boh/outertune/models/QueueBoard.kt
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@ import kotlinx.coroutines.CoroutineScope
import kotlinx.coroutines.Dispatchers
import kotlinx.coroutines.flow.MutableStateFlow
import kotlinx.coroutines.launch
import kotlinx.coroutines.sync.Mutex
import kotlinx.coroutines.sync.withLock
import okhttp3.internal.toImmutableList
import timber.log.Timber
import kotlin.math.max
Expand Down Expand Up @@ -85,6 +87,8 @@ class QueueBoard(queues: MutableList<MultiQueueObject> = ArrayList()) {
private var masterIndex = masterQueues.size - 1 // current queue index
var detachedHead = false

private val mutex = Mutex()


/**
* ========================
Expand Down Expand Up @@ -121,7 +125,9 @@ class QueueBoard(queues: MutableList<MultiQueueObject> = ArrayList()) {

regenerateIndexes()
CoroutineScope(Dispatchers.IO).launch {
player.database.updateAllQueues(masterQueues)
mutex.withLock { // possible ConcurrentModificationException
player.database.updateAllQueues(masterQueues)
}
}
}

Expand Down Expand Up @@ -174,6 +180,8 @@ class QueueBoard(queues: MutableList<MultiQueueObject> = ArrayList()) {

val match = masterQueues.firstOrNull { it.title == title } // look for matching queue. Title is uid
if (match != null) { // found an existing queue
// Titles ending in "+​" (u200B) signify a extension queue
val anyExts = masterQueues.firstOrNull { it.title == match.title + " +\u200B" }
if (replace) { // force replace
if (QUEUE_DEBUG)
Timber.tag(TAG).d("Adding to queue: Replacing all queue items")
Expand Down Expand Up @@ -226,23 +234,29 @@ class QueueBoard(queues: MutableList<MultiQueueObject> = ArrayList()) {
}

bubbleUp(match, player) // move queue to end of list so it shows as most recent
} else if (match.title.endsWith('+')) { // this queue is an already an extension queue
} else if (match.title.endsWith("+\u200B") || anyExts != null) { // this queue is an already an extension queue
if (QUEUE_DEBUG)
Timber.tag(TAG).d("Adding to queue: extension queue additive")
// add items to existing queue unconditionally
match.queue.addAll(mediaList.filterNotNull())
match.unShuffled.addAll(mediaList.filterNotNull())
if (anyExts != null) {
anyExts.queue.addAll(mediaList.filterNotNull())
anyExts.unShuffled.addAll(mediaList.filterNotNull())
} else {
match.queue.addAll(mediaList.filterNotNull())
match.unShuffled.addAll(mediaList.filterNotNull())
}

// rewrite queue
if (player.dataStore.get(PersistentQueueKey, true)) {
CoroutineScope(Dispatchers.IO).launch {
player.database.rewriteQueue(match)
player.database.rewriteQueue(anyExts ?: match)
}
}

// don't change index
bubbleUp(match, player) // move queue to end of list so it shows as most recent
} else { // make new extension queue
}
else { // make new extension queue
if (QUEUE_DEBUG)
Timber.tag(TAG).d("Adding to queue: extension queue creation (and additive)")
// add items to NEW queue unconditionally (add entirely new queue)
Expand All @@ -259,7 +273,7 @@ class QueueBoard(queues: MutableList<MultiQueueObject> = ArrayList()) {

val newQueue = MultiQueueObject(
QueueEntity.generateQueueId(),
"$title +",
"$title +\u200B",
shufQueue,
unShufQueue,
false,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -372,6 +372,9 @@ class MusicService : MediaLibraryService(),
val queuePos = queueBoard.setCurrQueue(this@MusicService, false)
if (queuePos != null) {
player.seekTo(queuePos, dataStore.get(LastPosKey, C.TIME_UNSET))
dataStore.edit { settings ->
settings[LastPosKey] = C.TIME_UNSET
}
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ fun AddToQueueDialog(


LaunchedEffect(Unit) {
queues = queueBoard.getAllQueues()
queues = queueBoard.getAllQueues().reversed()
}

if (isVisible) {
Expand All @@ -70,14 +70,14 @@ fun AddToQueueDialog(
)
}

var index = 1
var index = queues.size
// add queue
items(queues) { queue ->
QueueListItem(
queue = queue,
number = index++,
number = index--,
modifier = Modifier.clickable {
onAdd(queue.title ?: "Queue")
onAdd(queue.title)
onDismiss()
}
)
Expand Down
24 changes: 24 additions & 0 deletions app/src/main/java/com/dd3boh/outertune/ui/menu/PlayerMenu.kt
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ import androidx.compose.foundation.layout.width
import androidx.compose.foundation.lazy.items
import androidx.compose.material.icons.Icons
import androidx.compose.material.icons.automirrored.rounded.PlaylistAdd
import androidx.compose.material.icons.automirrored.rounded.QueueMusic
import androidx.compose.material.icons.automirrored.rounded.VolumeUp
import androidx.compose.material.icons.rounded.AddCircleOutline
import androidx.compose.material.icons.rounded.Info
Expand Down Expand Up @@ -73,6 +74,7 @@ import com.dd3boh.outertune.R
import com.dd3boh.outertune.constants.ListItemHeight
import com.dd3boh.outertune.models.MediaMetadata
import com.dd3boh.outertune.playback.ExoDownloadService
import com.dd3boh.outertune.playback.PlayerConnection.Companion.queueBoard
import com.dd3boh.outertune.ui.component.BigSeekBar
import com.dd3boh.outertune.ui.component.BottomSheetState
import com.dd3boh.outertune.ui.component.DownloadGridMenu
Expand Down Expand Up @@ -110,6 +112,22 @@ fun PlayerMenu(

val download by LocalDownloadUtil.current.getDownload(mediaMetadata.id).collectAsState(initial = null)

var showChooseQueueDialog by rememberSaveable {
mutableStateOf(false)
}

AddToQueueDialog(
isVisible = showChooseQueueDialog,
onAdd = { queueName ->
queueBoard.add(queueName, listOf(mediaMetadata), playerConnection, forceInsert = true, delta = false)
queueBoard.setCurrQueue(playerConnection)
},
onDismiss = {
showChooseQueueDialog = false
onDismiss() // here we dismiss since we switch to the queue anyways
}
)

var showChoosePlaylistDialog by rememberSaveable {
mutableStateOf(false)
}
Expand Down Expand Up @@ -296,6 +314,12 @@ fun PlayerMenu(
playerConnection.service.startRadioSeamlessly()
onDismiss()
}
GridMenuItem(
icon = Icons.AutoMirrored.Rounded.QueueMusic,
title = R.string.add_to_queue
) {
showChooseQueueDialog = true
}
GridMenuItem(
icon = Icons.AutoMirrored.Rounded.PlaylistAdd,
title = R.string.add_to_playlist
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,38 +37,6 @@ class FFMpegScanner : MetadataScanner {
System.loadLibrary("swscale")
}

/**
* Given a path to a file, extract necessary metadata
*
* @param path Full file path
*/
override fun getMediaStoreSupplement(path: String): ExtraMetadataWrapper {
if (EXTRACTOR_DEBUG)
Timber.tag(EXTRACTOR_TAG).d("Starting MediaStoreSupplement session on: $path")
val ffmpeg = FFMpegWrapper()
val data = ffmpeg.getAudioMetadata(path)

if (EXTRACTOR_DEBUG && DEBUG_SAVE_OUTPUT) {
Timber.tag(EXTRACTOR_TAG).d("Full output for: $path \n $data")
}

var artists: String? = null
var genres: String? = null
var date: String? = null

data.lines().forEach {
val tag = it.substringBefore(':')
when (tag) {
"ARTISTS", "ARTIST", "artist" -> artists = it.substringAfter(':')
"GENRE", "genre" -> genres = it.substringAfter(':')
"DATE", "date" -> date = it.substringAfter(':')
else -> ""
}
}

return ExtraMetadataWrapper(artists, genres, date, null)
}

/**
* Given a path to a file, extract all necessary metadata
*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,6 @@ import com.dd3boh.outertune.models.SongTempData
* Returns metadata information
*/
interface MetadataScanner {
/**
* Given a path to a file, extract necessary metadata MediaStore fails to
* deliver upon. Extracts artists, genres, and date
*
* @param path Full file path
*/
fun getMediaStoreSupplement(path: String): ExtraMetadataWrapper

/**
* Given a path to a file, extract necessary metadata. For fields FFmpeg is
Expand Down
2 changes: 1 addition & 1 deletion ffMetadataEx/src/main/cpp/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ set_target_properties( # Specifies the target library.
# Include FFmpeg headers
include_directories(${CMAKE_SOURCE_DIR}/ffmpeg-android-maker/output/include/${ANDROID_ABI})

add_library(ffmetaexjni SHARED ffMetaExJni.c)
add_library(ffmetaexjni SHARED ffMetaExJni.cpp)

# Link FFmpeg libraries
target_link_libraries(ffmetaexjni
Expand Down
Loading

0 comments on commit eae00fa

Please sign in to comment.