Compare commits
8 Commits
2.0.0-alph
...
develop
Author | SHA1 | Date |
---|---|---|
![]() |
5f5b185cfa | |
![]() |
2c0f0fd86b | |
![]() |
bd12cc389e | |
![]() |
aaa4e6eb92 | |
![]() |
e1bc3d2474 | |
![]() |
f8bfbb4434 | |
![]() |
6bc858986b | |
![]() |
df34dcb452 |
|
@ -1,7 +1,7 @@
|
|||
openapi: 3.0.3
|
||||
info:
|
||||
title: Funkwhale API
|
||||
version: 2.0.0a1
|
||||
version: 2.0.0a2
|
||||
description: |
|
||||
# Funkwhale API
|
||||
|
||||
|
|
|
@ -1,3 +1,5 @@
|
|||
import os
|
||||
import pathlib
|
||||
import urllib.parse
|
||||
|
||||
from django import urls
|
||||
|
@ -903,13 +905,17 @@ class FSImportSerializer(serializers.Serializer):
|
|||
prune = serializers.BooleanField(required=False, default=True)
|
||||
outbox = serializers.BooleanField(required=False, default=False)
|
||||
broadcast = serializers.BooleanField(required=False, default=False)
|
||||
replace = serializers.BooleanField(required=False, default=False)
|
||||
batch_size = serializers.IntegerField(required=False, default=1000)
|
||||
verbosity = serializers.IntegerField(required=False, default=1)
|
||||
|
||||
def validate_path(self, value):
|
||||
try:
|
||||
utils.browse_dir(settings.MUSIC_DIRECTORY_PATH, value)
|
||||
except (NotADirectoryError, FileNotFoundError, ValueError):
|
||||
except NotADirectoryError:
|
||||
if not os.path.isfile(pathlib.Path(settings.MUSIC_DIRECTORY_PATH) / value):
|
||||
raise serializers.ValidationError("Invalid path")
|
||||
except (FileNotFoundError, ValueError):
|
||||
raise serializers.ValidationError("Invalid path")
|
||||
|
||||
return value
|
||||
|
|
|
@ -1209,6 +1209,7 @@ def fs_import(
|
|||
prune=True,
|
||||
outbox=False,
|
||||
broadcast=False,
|
||||
replace=False,
|
||||
batch_size=1000,
|
||||
verbosity=1,
|
||||
):
|
||||
|
@ -1229,7 +1230,7 @@ def fs_import(
|
|||
"batch_size": batch_size,
|
||||
"async_": False,
|
||||
"prune": prune,
|
||||
"replace": False,
|
||||
"replace": replace,
|
||||
"verbosity": verbosity,
|
||||
"exit_on_failure": False,
|
||||
"outbox": outbox,
|
||||
|
|
|
@ -386,6 +386,7 @@ class LibraryViewSet(
|
|||
prune=serializer.validated_data["prune"],
|
||||
outbox=serializer.validated_data["outbox"],
|
||||
broadcast=serializer.validated_data["broadcast"],
|
||||
replace=serializer.validated_data["replace"],
|
||||
batch_size=serializer.validated_data["batch_size"],
|
||||
verbosity=serializer.validated_data["verbosity"],
|
||||
)
|
||||
|
|
|
@ -143,7 +143,7 @@ class PlaylistViewSet(
|
|||
|
||||
# Apply pagination
|
||||
paginator = PageNumberPagination()
|
||||
paginator.page_size = 100 # Set the page size (number of items per page)
|
||||
paginator.page_size = 50 # Set the page size (number of items per page)
|
||||
paginated_plts = paginator.paginate_queryset(plts, request)
|
||||
|
||||
# Serialize the paginated data
|
||||
|
|
|
@ -135,7 +135,8 @@ build-backend = "poetry.core.masonry.api"
|
|||
|
||||
[tool.pylint.master]
|
||||
load-plugins = ["pylint_django"]
|
||||
django-settings-module = "config.settings.testing"
|
||||
django-settings-module = "config.settings.local"
|
||||
init-hook = 'import os; os.environ.setdefault("FUNKWHALE_URL", "https://test.federation")'
|
||||
|
||||
[tool.pylint.messages_control]
|
||||
disable = [
|
||||
|
|
|
@ -1528,6 +1528,7 @@ def test_fs_import_post(
|
|||
prune=True,
|
||||
outbox=False,
|
||||
broadcast=False,
|
||||
replace=False,
|
||||
batch_size=1000,
|
||||
verbosity=1,
|
||||
)
|
||||
|
|
|
@ -0,0 +1 @@
|
|||
Allow importing single files using fs-import API endpoint
|
|
@ -58,6 +58,8 @@ Once we're ready to release a new version of the software, we can use the follow
|
|||
7. Update the next release version
|
||||
|
||||
```sh
|
||||
docker compose build api
|
||||
docker compose run --rm api funkwhale-manage spectacular > ./api/funkwhale_api/common/schema.yml
|
||||
cd api
|
||||
poetry version "$NEXT_RELEASE"
|
||||
cd ..
|
||||
|
|
|
@ -45,7 +45,7 @@ interface Props {
|
|||
paginateResults?: boolean
|
||||
total?: number
|
||||
page?: number
|
||||
paginateBy?: number,
|
||||
paginateBy?: number
|
||||
|
||||
unique?: boolean
|
||||
}
|
||||
|
|
|
@ -27,6 +27,14 @@ const soundCache = new LRUCache<number, Sound>({
|
|||
dispose: (sound) => sound.dispose()
|
||||
})
|
||||
|
||||
// used to make soundCache reactive
|
||||
const soundCacheVersion = ref(0)
|
||||
function setSoundCache(trackId: number, sound: Sound) {
|
||||
soundCache.set(trackId, sound)
|
||||
soundCacheVersion.value++ // bump to trigger reactivity
|
||||
}
|
||||
|
||||
|
||||
const currentTrack = ref<QueueTrack>()
|
||||
|
||||
export const fetchTrackSources = async (id: number): Promise<QueueTrackSource[]> => {
|
||||
|
@ -139,7 +147,7 @@ export const useTracks = createGlobalState(() => {
|
|||
}
|
||||
|
||||
// Add track to the sound cache and remove from the promise cache
|
||||
soundCache.set(track.id, sound)
|
||||
setSoundCache(track.id, sound)
|
||||
soundPromises.delete(track.id)
|
||||
|
||||
return sound
|
||||
|
@ -224,7 +232,12 @@ export const useTracks = createGlobalState(() => {
|
|||
})
|
||||
})
|
||||
|
||||
const currentSound = computed(() => soundCache.get(currentTrack.value?.id ?? -1))
|
||||
const currentSound = computed(() => {
|
||||
soundCacheVersion.value //trigger reactivity
|
||||
const trackId = currentTrack.value?.id ?? -1
|
||||
const sound = soundCache.get(trackId)
|
||||
return sound
|
||||
})
|
||||
|
||||
const clearCache = () => {
|
||||
return soundCache.clear()
|
||||
|
|
|
@ -4611,5 +4611,8 @@
|
|||
"title": "Радио"
|
||||
}
|
||||
}
|
||||
},
|
||||
"vui": {
|
||||
"radio": "Радио"
|
||||
}
|
||||
}
|
||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -96,20 +96,19 @@ const loadMoreTracks = async () => {
|
|||
if (nextPage.value) {
|
||||
isLoadingMoreTracks.value = true; // Set loading state for the button
|
||||
try {
|
||||
const response = await axios.get(nextPage.value);
|
||||
const response = await axios.get(nextPage.value)
|
||||
|
||||
// Append new tracks to the existing list
|
||||
fullPlaylistTracks.value = [...fullPlaylistTracks.value, ...response.data.results];
|
||||
|
||||
fullPlaylistTracks.value = [...fullPlaylistTracks.value, ...response.data.results]
|
||||
// Update pagination metadata
|
||||
nextPage.value = response.data.next;
|
||||
nextPage.value = response.data.next
|
||||
} catch (error) {
|
||||
useErrorHandler(error as Error)
|
||||
} finally {
|
||||
isLoadingMoreTracks.value = false; // Reset loading state
|
||||
}
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
fetchData()
|
||||
|
||||
|
|
Loading…
Reference in New Issue