diff --git a/CHANGELOG.md b/CHANGELOG.md
index 9a24ffb4..96d20d93 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -11,6 +11,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- German translation
+### Changed
+
+- Settings: Added a "backend" section, and removed backend selection from Playback to avoid confusion
+
### Fixed
- Display issue in playlist view
diff --git a/playlet-lib/src/components/Screens/SearchScreen/SearchSuggestionsTask.bs b/playlet-lib/src/components/Screens/SearchScreen/SearchSuggestionsTask.bs
index 9497a399..e5e1d6d0 100644
--- a/playlet-lib/src/components/Screens/SearchScreen/SearchSuggestionsTask.bs
+++ b/playlet-lib/src/components/Screens/SearchScreen/SearchSuggestionsTask.bs
@@ -17,7 +17,7 @@ function SearchSuggestionsTask(input as object) as object
suggestions: []
}
else
- backend = preferencesNode["playback.backend"]
+ backend = preferencesNode["backend.selected"]
if backend = "playlet"
searchSuggestsions = InnertubeService.SearchSuggestions(q, m.top.cancellation)
else
diff --git a/playlet-lib/src/components/Services/Invidious/InvidiousService.bs b/playlet-lib/src/components/Services/Invidious/InvidiousService.bs
index 3d77dac7..3a5b79e0 100644
--- a/playlet-lib/src/components/Services/Invidious/InvidiousService.bs
+++ b/playlet-lib/src/components/Services/Invidious/InvidiousService.bs
@@ -70,18 +70,18 @@ namespace Invidious
if m.preferences = invalid
m.preferences = m.invidiousNode.preferences
end if
- instance = m.preferences["invidious.instance"]
- if not StringUtils.IsNullOrEmpty(instance)
- return instance
+ backend = m.preferences["backend.selected"]
+ if backend = "invidious"
+ instance = m.preferences["invidious.instance"]
+ if not StringUtils.IsNullOrEmpty(instance)
+ return instance
+ end if
end if
instance = DEFAULT_INSTANCE
- if instance.StartsWith("http://127.0.0.1:8888")
- address = m.invidiousNode.webServer@.GetServerAddress()
- instance = instance.Replace("http://127.0.0.1:8888", address)
- end if
-
+ address = m.invidiousNode.webServer@.GetServerAddress()
+ instance = instance.Replace("http://127.0.0.1:8888", address)
return instance
end function
diff --git a/playlet-lib/src/components/Services/Preferences/Preferences.bs b/playlet-lib/src/components/Services/Preferences/Preferences.bs
index 8a833dba..88922a90 100644
--- a/playlet-lib/src/components/Services/Preferences/Preferences.bs
+++ b/playlet-lib/src/components/Services/Preferences/Preferences.bs
@@ -143,7 +143,23 @@ function MigrateExistingPreferences(userPrefs as object) as boolean
isDirty = true
end if
+ if userPrefs.__version = 3
+ if IsString(userPrefs["playback.backend"])
+ backend = userPrefs["playback.backend"]
+ userPrefs.Delete("playback.backend")
+ userPrefs["backend.selected"] = backend
+ end if
+ userPrefs.__version = 4
+ isDirty = true
+ end if
+
' TODO:P2 handle case where saved preferences version is higher than current version (e.g. user downgraded)
+
+ #if DEBUG
+ if userPrefs.__version <> m.top.__version
+ throw "Preferences version mismatch. Expected: " + m.top.__version + ", found: " + userPrefs.__version
+ end if
+ #end if
return isDirty
end function
diff --git a/playlet-lib/src/components/Services/Preferences/Preferences.xml b/playlet-lib/src/components/Services/Preferences/Preferences.xml
index e8f8b7d9..fd6ed8ee 100644
--- a/playlet-lib/src/components/Services/Preferences/Preferences.xml
+++ b/playlet-lib/src/components/Services/Preferences/Preferences.xml
@@ -5,7 +5,7 @@
user prefs saved need to be migrated. If the version is less than the
current version, a migration is needed.
-->
-
+
diff --git a/playlet-lib/src/components/VideoPlayer/VideoContentTask.bs b/playlet-lib/src/components/VideoPlayer/VideoContentTask.bs
index d6e7d6c4..ea08a41b 100644
--- a/playlet-lib/src/components/VideoPlayer/VideoContentTask.bs
+++ b/playlet-lib/src/components/VideoPlayer/VideoContentTask.bs
@@ -20,7 +20,7 @@ function VideoContentTask(input as object) as object
service = new Invidious.InvidiousService(invidiousNode)
- backend = preferencesNode["playback.backend"]
+ backend = preferencesNode["backend.selected"]
if backend = "playlet"
metadata = InnertubeService.GetVideoMetadata(contentNode.videoId, {
"cancellation": m.top.cancellation
diff --git a/playlet-lib/src/components/VideoPlayerDev/VideoContentTaskDev.bs b/playlet-lib/src/components/VideoPlayerDev/VideoContentTaskDev.bs
index d616b95c..972447c2 100644
--- a/playlet-lib/src/components/VideoPlayerDev/VideoContentTaskDev.bs
+++ b/playlet-lib/src/components/VideoPlayerDev/VideoContentTaskDev.bs
@@ -25,7 +25,7 @@ function VideoContentTaskDev(input as object) as object
backgroundPoster.uri = `${instance}/vi/${videoId}/maxresdefault.jpg`
- backend = preferencesNode["playback.backend"]
+ backend = preferencesNode["backend.selected"]
if backend = "playlet"
metadata = InnertubeService.GetVideoMetadata(videoId, { cancellation: m.top.cancellation })
else
diff --git a/playlet-lib/src/components/VideoQueue/VideoQueueViewContentTask.bs b/playlet-lib/src/components/VideoQueue/VideoQueueViewContentTask.bs
index a56cf071..439113fd 100644
--- a/playlet-lib/src/components/VideoQueue/VideoQueueViewContentTask.bs
+++ b/playlet-lib/src/components/VideoQueue/VideoQueueViewContentTask.bs
@@ -16,7 +16,7 @@ function VideoQueueViewContentTask(input as object) as object
index = MathUtils.Clamp(input.index - 2, 0, videoNodes.Count() - 1)
- backend = preferencesNode["playback.backend"]
+ backend = preferencesNode["backend.selected"]
requestOptions = {
cacheSeconds: 8640000 ' 100 days
diff --git a/playlet-lib/src/config/preferences.json5 b/playlet-lib/src/config/preferences.json5
index e9703ac4..695e5de0 100644
--- a/playlet-lib/src/config/preferences.json5
+++ b/playlet-lib/src/config/preferences.json5
@@ -27,21 +27,28 @@
visibility: "web",
svelteComponent: "EditQualityControl",
},
+ ],
+ },
+ {
+ displayText: "Backend",
+ key: "backend",
+ description: "Backend preferences",
+ children: [
{
- displayText: "Backend",
- key: "playback.backend",
- description: "The backend used for fetching video data. The Playlet backend is experimental",
+ displayText: "Selected backend",
+ key: "backend.selected",
+ description: "The backend used for browsing and playing videos.",
type: "radio",
defaultValue: "playlet",
options: [
- {
- displayText: "Invidious",
- value: "invidious",
- },
{
displayText: "Playlet (local)",
value: "playlet",
},
+ {
+ displayText: "Invidious",
+ value: "invidious",
+ },
],
},
],